Skip to content

Commit 14b52bd

Browse files
authored
Merge pull request #350 from PHPOffice/develop
Release 0.8.0
2 parents 4f40d93 + 179aed2 commit 14b52bd

File tree

97 files changed

+5050
-4241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+5050
-4241
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: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Changelog
22

3+
## 0.8.0 - 2017-04-03
4+
5+
### Bugfix
6+
- PowerPoint2007 Writer : Fixed the marker on line chart when symbol is none - @Napryc GH-211
7+
- PowerPoint2007 Writer : Fixed the format value in Pie Chart - @Napryc GH-212
8+
- PowerPoint2007 Writer : The presentation need repairs on Mac @jrking4 GH-266 GH-276
9+
- PowerPoint2007 Writer : Fix for PowerPoint2007 Writer (Need repair) @Progi1984 GH-266 GH-274 GH-276 GH-282 GH-302
10+
- PowerPoint2007 Writer : Fixed the axis title in bar chart - @pgee70 GH-267
11+
- PowerPoint2007 Writer : Fixed the label position in bar chart - @pgee70 GH-268
12+
- 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
14+
15+
### Changes
16+
- Misc : Added two methods for setting Border & Fill in Legend - @Progi1984 GH-265
17+
18+
### Features
19+
- ODPresentation Writer : Show/Hide Value / Name / Series Name in Chart - @Progi1984 GH-272
20+
- ODPresentation Writer : Axis Bounds in Chart - @Progi1984 GH-269
21+
- PowerPoint97 Reader : Support of Slide Note - @Progi1984 GH-226
22+
- PowerPoint2007 Reader : Support of Shape Table - @Progi1984 GH-240
23+
- PowerPoint2007 Reader : Support of Slide Note - @Progi1984 GH-226
24+
- PowerPoint2007 Reader : Support text direction in Alignment for Table - @Progi1984 GH-218
25+
- PowerPoint2007 Writer : Implement character spacing - @jvanoostrom GH-301
26+
- PowerPoint2007 Writer : Axis Bounds in Chart - @Progi1984 GH-269
27+
- PowerPoint2007 Writer : Implement Legend Key in Series for Chart - @Progi1984 GH-319
28+
- PowerPoint2007 Writer : Support text direction in Alignment for Table - @SeregPie GH-218
29+
- PowerPoint2007 Writer : Support tick mark & unit in Axis for Chart - @Faab GH-218
30+
- PowerPoint2007 Writer : Support separator in Series for Chart - @jphchaput GH-218
31+
- PowerPoint2007 Writer : Add support for Outline in Axis - @Progi1984 GH-255
32+
- PowerPoint2007 Writer : Support autoscale for Chart - @Progi1984 GH-293
33+
334
## 0.7.0 - 2016-09-12
435

536
### Bugfix

README.md

Lines changed: 4 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

@@ -45,6 +47,7 @@ PHPPresentation requires the following:
4547
- [Zip extension](http://php.net/manual/en/book.zip.php)
4648
- [XML Parser extension](http://www.php.net/manual/en/xml.installation.php)
4749
- [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php) (optional, used to write DOCX and ODT)
50+
- [GD](http://php.net/manual/en/book.image.php)
4851

4952
### Installation
5053

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"require-dev": {
2828
"phpunit/phpunit": "3.7.*",
2929
"phpdocumentor/phpdocumentor":"2.*",
30+
"twig/twig":"1.27",
3031
"phpmd/phpmd": "2.*",
3132
"sebastian/phpcpd": "2.*",
3233
"phploc/phploc": "2.*",

docs/readers.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ The name of the reader is ``ODPresentation``.
1010

1111
.. code-block:: php
1212
13-
$oWriter = IOFactory::createReader('ODPresentation');
14-
$oWriter->load(__DIR__ . '/sample.odp');
13+
$oReader = IOFactory::createReader('ODPresentation');
14+
$oReader->load(__DIR__ . '/sample.odp');
1515
1616
PowerPoint97
1717
------------
@@ -20,8 +20,8 @@ The name of the reader is ``PowerPoint97``.
2020

2121
.. code-block:: php
2222
23-
$oWriter = IOFactory::createReader('PowerPoint97');
24-
$oWriter->load(__DIR__ . '/sample.ppt');
23+
$oReader = IOFactory::createReader('PowerPoint97');
24+
$oReader->load(__DIR__ . '/sample.ppt');
2525
2626
PowerPoint2007
2727
--------------
@@ -30,8 +30,8 @@ The name of the reader is ``PowerPoint2007``.
3030

3131
.. code-block:: php
3232
33-
$oWriter = IOFactory::createReader('PowerPoint2007');
34-
$oWriter->load(__DIR__ . '/sample.pptx');
33+
$oReader = IOFactory::createReader('PowerPoint2007');
34+
$oReader->load(__DIR__ . '/sample.pptx');
3535
3636
Serialized
3737
----------
@@ -40,5 +40,5 @@ The name of the reader is ``Serialized``.
4040

4141
.. code-block:: php
4242
43-
$oWriter = IOFactory::createReader('Serialized');
44-
$oWriter->load(__DIR__ . '/sample.phppt');
43+
$oReader = IOFactory::createReader('Serialized');
44+
$oReader->load(__DIR__ . '/sample.phppt');

docs/shapes_chart.rst

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,59 @@ For each gridline, you can custom the width (in points), the fill type and the f
3434
$oShape->getPlotArea()->setType($oLine);
3535
$oShape->getPlotArea()->getAxisX()->setMajorGridlines($oGridLines);
3636
37+
For Axis, you can define the min & max bounds with `setMinBounds` & `setMaxBounds` methods.
38+
For resetting them, you pass null as parameter to these methods.
39+
40+
.. code-block:: php
41+
42+
use \PhpOffice\PhpPresentation\Shape\Chart\Gridlines;
43+
44+
$oLine = new Line();
45+
46+
$oShape = $oSlide->createChartShape();
47+
$oShape->getPlotArea()->setType($oLine);
48+
$oShape->getPlotArea()->getAxisX()->setMinBounds(0);
49+
$oShape->getPlotArea()->getAxisX()->setMaxBounds(200);
50+
51+
You can define outline for each axis (X & Y).
52+
53+
.. code-block:: php
54+
55+
$oLine = new Line();
56+
57+
$oShape = $oSlide->createChartShape();
58+
$oShape->getPlotArea()->setType($oLine);
59+
$oShape->getPlotArea()->getAxisX()->getOutline()->setWidth(10);
60+
$oShape->getPlotArea()->getAxisX()->getOutline()->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_BLUE));
61+
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+
3790
Title
3891
^^^^^
3992

@@ -90,6 +143,28 @@ Each position is described in `MSDN <https://msdn.microsoft.com/en-us/library/mt
90143
$oSeries = new Series('Downloads', $seriesData);
91144
$oSeries->setLabelPosition(Series::LABEL_INSIDEEND);
92145
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+
159+
View3D
160+
^^^^^^
161+
162+
For enabling the autoscale for a shape, you must reset the height percent.
163+
164+
.. code-block:: php
165+
166+
$oShape->getView3D()->setHeightPercent(null);
167+
93168
Types
94169
-----
95170

docs/shapes_table.rst

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ You can access cell objects with `nextCell` method of a Row object.
3636
// Get the second cell
3737
$cellA2 = $row->nextCell();
3838
39-
You can access cell object directly
39+
You can access cell object directly.
4040

4141
.. code-block:: php
4242
@@ -46,14 +46,45 @@ You can access cell object directly
4646
$cellA1 = $row->getCell(0);
4747
// Get the second cell
4848
$cellA2 = $row->getCell(1);
49-
49+
50+
51+
Define margins of a cell
52+
~~~~~~~~~~~~~~~~~~~~~~~~
53+
Margins of cells are defined by margins of the first paragraph of cell.
54+
55+
For defining margins of cell, you can use the `setMargin*` method of a Alignment object of the active paragraph of a Cell object.
56+
57+
.. code-block:: php
58+
59+
$tableShape = $slide->createTableShape($columns);
60+
$row = $tableShape->createRow();
61+
$cellA1 = $row->nextCell();
62+
$cellA1->getActiveParagraph()->getAlignment()
63+
->setMarginBottom(20)
64+
->setMarginLeft(40)
65+
->setMarginRight(60)
66+
->setMarginTop(80);
67+
68+
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+
5081
5182
Define the width of a cell
5283
~~~~~~~~~~~~~~~~~~~~~~~~~~
5384
The width of cells are defined by the width of cell of the first row.
5485
If not defined, all cells widths are calculated from the width of the shape and the number of columns.
5586

56-
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.
5788
The width is in pixels.
5889

5990
.. 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="31" />
23+
<property name="minimum" value="35" />
2424
</properties>
2525
</rule>
2626
<rule ref="rulesets/design.xml/NumberOfChildren">

samples/Sample_04_Table.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
$cell->getBorders()->getBottom()->setLineWidth(4)
5151
->setLineStyle(Border::LINE_SINGLE)
5252
->setDashStyle(Border::DASH_DASH);
53+
$cell->getActiveParagraph()->getAlignment()
54+
->setMarginLeft(10);
5355

5456
// Add row
5557
echo date('H:i:s') . ' Add row'.EOL;
@@ -60,6 +62,7 @@
6062
->setStartColor(new Color('FFE06B20'))
6163
->setEndColor(new Color('FFFFFFFF'));
6264
$row->nextCell()->createTextRun('R1C1')->getFont()->setBold(true);
65+
$row->getCell()->getActiveParagraph()->getAlignment()->setMarginLeft(20);
6366
$row->nextCell()->createTextRun('R1C2')->getFont()->setBold(true);
6467
$row->nextCell()->createTextRun('R1C3')->getFont()->setBold(true);
6568

@@ -76,6 +79,9 @@
7679
->setStartColor(new Color('FFE06B20'))
7780
->setEndColor(new Color('FFE06B20'));
7881
$row->nextCell()->createTextRun('R2C1');
82+
$row->getCell()->getActiveParagraph()->getAlignment()
83+
->setMarginLeft(30)
84+
->setTextDirection(\PhpOffice\PhpPresentation\Style\Alignment::TEXT_DIRECTION_VERTICAL_270);
7985
$row->nextCell()->createTextRun('R2C2');
8086
$row->nextCell()->createTextRun('R2C3');
8187

@@ -86,6 +92,7 @@
8692
->setStartColor(new Color('FFE06B20'))
8793
->setEndColor(new Color('FFE06B20'));
8894
$row->nextCell()->createTextRun('R3C1');
95+
$row->getCell()->getActiveParagraph()->getAlignment()->setMarginLeft(40);
8996
$row->nextCell()->createTextRun('R3C2');
9097
$row->nextCell()->createTextRun('R3C3');
9198

@@ -98,6 +105,7 @@
98105
$cellC1 = $row->nextCell();
99106
$textRunC1 = $cellC1->createTextRun('Link');
100107
$textRunC1->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation');
108+
$cellC1->getActiveParagraph()->getAlignment()->setMarginLeft(50);
101109
$cellC2 = $row->nextCell();
102110
$textRunC2 = $cellC2->createTextRun('RichText with');
103111
$textRunC2->getFont()->setBold(true);

samples/Sample_05_Chart.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
use PhpOffice\PhpPresentation\Style\Color;
1717
use PhpOffice\PhpPresentation\Style\Fill;
1818
use PhpOffice\PhpPresentation\Style\Shadow;
19-
use PhpOffice\PhpPresentation\Style\PhpOffice\PhpPresentation\Style;
2019

2120
function fnSlide_Area(PhpPresentation $objPHPPresentation) {
2221
global $oFill;
2322
global $oShadow;
24-
23+
2524
// Generate sample data for chart
2625
echo date('H:i:s') . ' Generate sample data for chart' . EOL;
2726
$seriesData = array(
@@ -33,11 +32,11 @@ function fnSlide_Area(PhpPresentation $objPHPPresentation) {
3332
'Saturday' => 9,
3433
'Sunday' => 7
3534
);
36-
35+
3736
// Create templated slide
3837
echo EOL . date('H:i:s') . ' Create templated slide' . EOL;
3938
$currentSlide = createTemplatedSlide($objPHPPresentation);
40-
39+
4140
// Create a line chart (that should be inserted in a shape)
4241
echo date('H:i:s') . ' Create a area chart (that should be inserted in a chart shape)' . EOL;
4342
$areaChart = new Area();
@@ -47,7 +46,7 @@ function fnSlide_Area(PhpPresentation $objPHPPresentation) {
4746
$series->getFill()->setStartColor(new Color('FF93A9CE'));
4847
$series->setLabelPosition(Series::LABEL_INSIDEEND);
4948
$areaChart->addSeries($series);
50-
49+
5150
// Create a shape (chart)
5251
echo date('H:i:s') . ' Create a shape (chart)' . EOL;
5352
$shape = $currentSlide->createChartShape();
@@ -59,6 +58,8 @@ function fnSlide_Area(PhpPresentation $objPHPPresentation) {
5958
$shape->getTitle()->setText('PHPPresentation Daily Downloads');
6059
$shape->getTitle()->getFont()->setItalic(true);
6160
$shape->getPlotArea()->setType($areaChart);
61+
$shape->getPlotArea()->getAxisX()->setTitle('Axis X');
62+
$shape->getPlotArea()->getAxisY()->setTitle('Axis Y');
6263
$shape->getView3D()->setRotationX(30);
6364
$shape->getView3D()->setPerspective(30);
6465
$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE);
@@ -90,6 +91,7 @@ function fnSlide_Bar(PhpPresentation $objPHPPresentation) {
9091
$series2->setShowSeriesName(true);
9192
$series2->getFont()->getColor()->setRGB('FF0000');
9293
$series2->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFC0504D'));
94+
$series2->setLabelPosition(Series::LABEL_INSIDEEND);
9395
$barChart->addSeries($series1);
9496
$barChart->addSeries($series2);
9597

@@ -457,6 +459,7 @@ function fnSlide_Pie(PhpPresentation $objPHPPresentation) {
457459
$series->setShowValue( false );
458460
$series->setShowSeriesName( false );
459461
$series->setShowCategoryName( true );
462+
$series->setDlblNumFormat('%d');
460463
$pieChart->addSeries($series);
461464

462465
// Create a shape (chart)

0 commit comments

Comments
 (0)