Skip to content

Commit cb69a1d

Browse files
committed
Merge branch 'develop' into issue255
Conflicts: CHANGELOG.md docs/shapes_chart.rst src/PhpPresentation/Shape/Chart/Axis.php
2 parents 54e917c + 3d9d26c commit cb69a1d

30 files changed

+1676
-984
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ php:
77
- 5.5
88
- 5.6
99
- 7.0
10+
- 7.1
1011
- hhvm
1112

1213
matrix:
1314
allow_failures:
15+
- php: 7.1
1416
- php: hhvm
1517

1618
env:

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,21 @@
1010
- PowerPoint2007 Writer : Fixed the axis title in bar chart - @pgee70 GH-267
1111
- PowerPoint2007 Writer : Fixed the label position in bar chart - @pgee70 GH-268
1212
- PowerPoint2007 Writer : Support of margins in cell in table - @carlosafonso @Progi1984 GH-273 GH-315
13+
- Fixed the corruption of file when an addExternalSlide is called - @Progi1984 GH-240
1314

1415
### Features
1516
- ODPresentation Writer : Show/Hide Value / Name / Series Name in Chart - @Progi1984 GH-272
1617
- ODPresentation Writer : Axis Bounds in Chart - @Progi1984 GH-269
18+
- PowerPoint97 Reader : Support of Slide Note - @Progi1984 GH-226
19+
- PowerPoint2007 Reader : Support of Shape Table - @Progi1984 GH-240
20+
- PowerPoint2007 Reader : Support of Slide Note - @Progi1984 GH-226
21+
- PowerPoint2007 Reader : Support text direction in Alignment for Table - @Progi1984 GH-218
1722
- PowerPoint2007 Writer : Implement character spacing - @jvanoostrom GH-301
1823
- PowerPoint2007 Writer : Axis Bounds in Chart - @Progi1984 GH-269
24+
- PowerPoint2007 Writer : Implement Legend Key in Series for Chart - @Progi1984 GH-319
25+
- PowerPoint2007 Writer : Support text direction in Alignment for Table - @SeregPie GH-218
26+
- PowerPoint2007 Writer : Support tick mark & unit in Axis for Chart - @Faab GH-218
27+
- PowerPoint2007 Writer : Support separator in Series for Chart - @jphchaput GH-218
1928
- PowerPoint2007 Writer : Add support for Outline in Axis - @Progi1984 GH-255
2029
- Misc : Added two methods for setting Border & Fill in Legend - @Progi1984 GH-265
2130

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# ![PHPPresentation](https://raw.githubusercontent.com/mvargasmoran/PHPPresentation/develop/docs/images/PHPPresentationLogo.png "PHPPresentation")
22

33
[![Latest Stable Version](https://poser.pugx.org/phpoffice/phppresentation/v/stable.png)](https://packagist.org/packages/phpoffice/phppresentation)
4-
[![Build Status](https://travis-ci.org/PHPOffice/PHPPresentation.svg?branch=master)](https://travis-ci.org/PHPOffice/PHPPresentation)
54
[![Code Climate](https://codeclimate.com/github/PHPOffice/PHPPresentation/badges/gpa.svg)](https://codeclimate.com/github/PHPOffice/PHPPresentation)
65
[![Test Coverage](https://codeclimate.com/github/PHPOffice/PHPPresentation/badges/coverage.svg)](https://codeclimate.com/github/PHPOffice/PHPPresentation/coverage)
76
[![Total Downloads](https://poser.pugx.org/phpoffice/phppresentation/downloads.png)](https://packagist.org/packages/phpoffice/phppresentation)
87
[![License](https://poser.pugx.org/phpoffice/phppresentation/license.png)](https://packagist.org/packages/phpoffice/phppresentation)
8+
[![BountySource](https://img.shields.io/bountysource/team/phpoffice/activity.svg)](https://www.bountysource.com/teams/phpoffice)
99
[![Join the chat at https://gitter.im/PHPOffice/PHPPresentation](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/PHPOffice/PHPPresentation)
1010

11+
Branch Master : [![Build Status](https://travis-ci.org/PHPOffice/PHPPresentation.svg?branch=master)](https://travis-ci.org/PHPOffice/PHPPresentation) [![Documentation Status](https://readthedocs.org/projects/phppresentation/badge/?version=master)](http://phppresentation.readthedocs.io/en/latest/?badge=master)
12+
Branch Develop : [![Build Status](https://travis-ci.org/PHPOffice/PHPPresentation.svg?branch=develop)](https://travis-ci.org/PHPOffice/PHPPresentation) [![Documentation Status](https://readthedocs.org/projects/phppresentation/badge/?version=develop)](http://phppresentation.readthedocs.io/en/latest/?badge=develop)
1113

1214
PHPPresentation is a library written in pure PHP that provides a set of classes to write to different presentation file formats, i.e. Microsoft [Office Open XML](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML) or OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF).
1315

docs/shapes_chart.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,34 @@ You can define outline for each axis (X & Y).
5959
$oShape->getPlotArea()->getAxisX()->getOutline()->setWidth(10);
6060
$oShape->getPlotArea()->getAxisX()->getOutline()->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_BLUE));
6161
62+
For Axis Y, you can define tick mark with `setMinorTickMark` & `setMajorTickMark` methods.
63+
For resetting them, you pass Axis::TICK_MARK_NONE as parameter to these methods.
64+
65+
.. code-block:: php
66+
67+
use \PhpOffice\PhpPresentation\Shape\Chart\Axis;
68+
69+
$oLine = new Line();
70+
71+
$oShape = $oSlide->createChartShape();
72+
$oShape->getPlotArea()->setType($oLine);
73+
$oShape->getPlotArea()->getAxisY()->setMinorTickMark(Axis::TICK_MARK_NONE);
74+
$oShape->getPlotArea()->getAxisY()->setMajorTickMark(Axis::TICK_MARK_INSIDE);
75+
76+
For Axis Y, you can define unit with `setMinorUnit` & `setMajorUnit` methods.
77+
For resetting them, you pass null as parameter to these methods.
78+
79+
.. code-block:: php
80+
81+
use \PhpOffice\PhpPresentation\Shape\Chart\Axis;
82+
83+
$oLine = new Line();
84+
85+
$oShape = $oSlide->createChartShape();
86+
$oShape->getPlotArea()->setType($oLine);
87+
$oShape->getPlotArea()->getAxisY()->setMinorUnit(null);
88+
$oShape->getPlotArea()->getAxisY()->setMajorUnit(0.05);
89+
6290
Title
6391
^^^^^
6492

@@ -115,6 +143,19 @@ Each position is described in `MSDN <https://msdn.microsoft.com/en-us/library/mt
115143
$oSeries = new Series('Downloads', $seriesData);
116144
$oSeries->setLabelPosition(Series::LABEL_INSIDEEND);
117145
146+
You can define if some informations are displayed.
147+
148+
.. code-block:: php
149+
150+
$oSeries = new Series('Downloads', $seriesData);
151+
$oSeries->setSeparator(';');
152+
$oSeries->setShowCategoryName(true);
153+
$oSeries->setShowLeaderLines(true);
154+
$oSeries->setShowLegendKey(true);
155+
$oSeries->setShowPercentage(true);
156+
$oSeries->setShowSeriesName(true);
157+
$oSeries->setShowValue(true);
158+
118159
Types
119160
-----
120161

docs/shapes_table.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,25 @@ For defining margins of cell, you can use the `setMargin*` method of a Alignment
6666
->setMarginTop(80);
6767
6868
69+
Define the text direction of a cell
70+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71+
For defining the text direction of cell, you can use the `setTextDirection` method of the `getAlignment` method of a Cell object.
72+
The width is in pixels.
73+
74+
.. code-block:: php
75+
76+
$tableShape = $slide->createTableShape($columns);
77+
$row = $tableShape->createRow();
78+
$cellA1 = $row->nextCell();
79+
$cellA1->getAlignment()->setTextDirection(\PhpOffice\PhpPresentation\Style\Alignment::TEXT_DIRECTION_VERTICAL_270);
80+
81+
6982
Define the width of a cell
7083
~~~~~~~~~~~~~~~~~~~~~~~~~~
7184
The width of cells are defined by the width of cell of the first row.
7285
If not defined, all cells widths are calculated from the width of the shape and the number of columns.
7386

74-
For defining the width of cell, you can use the `setWidth` method of a Cell object.
87+
For defining the width of cell, you can use the `setWidth` method of a Cell object.
7588
The width is in pixels.
7689

7790
.. code-block:: php

phpmd.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<!-- PptSlides needs more coupling (default: 13) -->
2121
<!-- Writer/Office2007/AbstractSlide needs more coupling (default: 13) -->
2222
<properties>
23-
<property name="minimum" value="32" />
23+
<property name="minimum" value="35" />
2424
</properties>
2525
</rule>
2626
<rule ref="rulesets/design.xml/NumberOfChildren">

samples/Sample_04_Table.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@
7979
->setStartColor(new Color('FFE06B20'))
8080
->setEndColor(new Color('FFE06B20'));
8181
$row->nextCell()->createTextRun('R2C1');
82-
$row->getCell()->getActiveParagraph()->getAlignment()->setMarginLeft(30);
82+
$row->getCell()->getActiveParagraph()->getAlignment()
83+
->setMarginLeft(30)
84+
->setTextDirection(\PhpOffice\PhpPresentation\Style\Alignment::TEXT_DIRECTION_VERTICAL_270);
8385
$row->nextCell()->createTextRun('R2C2');
8486
$row->nextCell()->createTextRun('R2C3');
8587

samples/Sample_20_ExternalSlide.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
include_once 'Sample_Header.php';
3+
4+
use PhpOffice\PhpPresentation\PhpPresentation;
5+
use PhpOffice\PhpPresentation\Shape\RichText;
6+
7+
// Create new PHPPresentation object
8+
echo date('H:i:s') . ' Create new PHPPresentation object' . EOL;
9+
$objPHPPresentation = new PhpPresentation();
10+
$objPHPPresentation->removeSlideByIndex(0);
11+
12+
$oReader = \PhpOffice\PhpPresentation\IOFactory::createReader('PowerPoint2007');
13+
$oPresentation04 = $oReader->load(__DIR__ . '/results/Sample_04_Table.pptx');
14+
15+
foreach ($oPresentation04->getAllSlides() as $oSlide) {
16+
$objPHPPresentation->addExternalSlide($oSlide);
17+
}
18+
19+
// Save file
20+
echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
21+
if (!CLI) {
22+
include_once 'Sample_Footer.php';
23+
}

samples/Sample_Header.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
* @param \PhpOffice\PhpPresentation\PhpPresentation $phpPresentation
8787
* @param string $filename
8888
* @param array $writers
89+
* @return string
8990
*/
9091
function write($phpPresentation, $filename, $writers)
9192
{
@@ -113,6 +114,7 @@ function write($phpPresentation, $filename, $writers)
113114
* Get ending notes
114115
*
115116
* @param array $writers
117+
* @return string
116118
*/
117119
function getEndingNotes($writers)
118120
{
@@ -296,6 +298,16 @@ protected function displayPhpPresentationInfo(PhpPresentation $oPHPPpt)
296298
$this->append('<dt>Background Image</dt><dd><img src="data:image/png;base64,'.base64_encode($sBkgImgContents).'"></dd>');
297299
}
298300
}
301+
$oNote = $oSlide->getNote();
302+
if ($oNote->getShapeCollection()->count() > 0) {
303+
$this->append('<dt>Notes</dt>');
304+
foreach ($oNote->getShapeCollection() as $oShape) {
305+
if ($oShape instanceof RichText) {
306+
$this->append('<dd>' . $oShape->getPlainText() . '</dd>');
307+
}
308+
}
309+
}
310+
299311
$this->append('</dl>');
300312
$this->append('</div>');
301313

src/PhpPresentation/PhpPresentation.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ public function addExternalSlide(Slide $slide)
324324
{
325325
$slide->rebindParent($this);
326326

327+
$this->addMasterSlide($slide->getSlideLayout()->getSlideMaster());
328+
327329
return $this->addSlide($slide);
328330
}
329331

@@ -353,8 +355,8 @@ public function createMasterSlide()
353355
* Add masterslide
354356
*
355357
* @param \PhpOffice\PhpPresentation\Slide\SlideMaster $slide
358+
* @return \PhpOffice\PhpPresentation\Slide\SlideMaster
356359
* @throws \Exception
357-
* @retun \PhpOffice\PhpPresentation\Slide\SlideMaster
358360
*/
359361
public function addMasterSlide(SlideMaster $slide = null)
360362
{

0 commit comments

Comments
 (0)