Skip to content

Commit 54e917c

Browse files
committed
Merge branch 'develop' into issue255
Conflicts: CHANGELOG.md docs/shapes_chart.rst samples/Sample_05_Chart_Line.php src/PhpPresentation/Shape/Chart/Axis.php src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php
2 parents f1e278f + 89b566d commit 54e917c

File tree

83 files changed

+3163
-2772
lines changed

Some content is hidden

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

83 files changed

+3163
-2772
lines changed

CHANGELOG.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@
33
## 0.8.0 - WIP
44

55
### Bugfix
6-
7-
### Changes
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
813

914
### Features
15+
- ODPresentation Writer : Show/Hide Value / Name / Series Name in Chart - @Progi1984 GH-272
16+
- ODPresentation Writer : Axis Bounds in Chart - @Progi1984 GH-269
17+
- PowerPoint2007 Writer : Implement character spacing - @jvanoostrom GH-301
18+
- PowerPoint2007 Writer : Axis Bounds in Chart - @Progi1984 GH-269
1019
- PowerPoint2007 Writer : Add support for Outline in Axis - @Progi1984 GH-255
20+
- Misc : Added two methods for setting Border & Fill in Legend - @Progi1984 GH-265
1121

1222
## 0.7.0 - 2016-09-12
1323

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ PHPPresentation requires the following:
4545
- [Zip extension](http://php.net/manual/en/book.zip.php)
4646
- [XML Parser extension](http://www.php.net/manual/en/xml.installation.php)
4747
- [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php) (optional, used to write DOCX and ODT)
48+
- [GD](http://php.net/manual/en/book.image.php)
4849

4950
### Installation
5051

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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ 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+
3751
You can define outline for each axis (X & Y).
3852

3953
.. code-block:: php

docs/shapes_table.rst

Lines changed: 20 additions & 2 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,7 +46,25 @@ 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+
5068
5169
Define the width of a cell
5270
~~~~~~~~~~~~~~~~~~~~~~~~~~

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="32" />
2424
</properties>
2525
</rule>
2626
<rule ref="rulesets/design.xml/NumberOfChildren">

samples/Sample_04_Table.php

Lines changed: 6 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,7 @@
7679
->setStartColor(new Color('FFE06B20'))
7780
->setEndColor(new Color('FFE06B20'));
7881
$row->nextCell()->createTextRun('R2C1');
82+
$row->getCell()->getActiveParagraph()->getAlignment()->setMarginLeft(30);
7983
$row->nextCell()->createTextRun('R2C2');
8084
$row->nextCell()->createTextRun('R2C3');
8185

@@ -86,6 +90,7 @@
8690
->setStartColor(new Color('FFE06B20'))
8791
->setEndColor(new Color('FFE06B20'));
8892
$row->nextCell()->createTextRun('R3C1');
93+
$row->getCell()->getActiveParagraph()->getAlignment()->setMarginLeft(40);
8994
$row->nextCell()->createTextRun('R3C2');
9095
$row->nextCell()->createTextRun('R3C3');
9196

@@ -98,6 +103,7 @@
98103
$cellC1 = $row->nextCell();
99104
$textRunC1 = $cellC1->createTextRun('Link');
100105
$textRunC1->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation');
106+
$cellC1->getActiveParagraph()->getAlignment()->setMarginLeft(50);
101107
$cellC2 = $row->nextCell();
102108
$textRunC2 = $cellC2->createTextRun('RichText with');
103109
$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)

samples/Sample_05_Chart_Line.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
include_once 'Sample_Header.php';
44

55
use PhpOffice\PhpPresentation\PhpPresentation;
6-
use PhpOffice\PhpPresentation\Shape\Chart\Type\Bar3D;
76
use PhpOffice\PhpPresentation\Shape\Chart\Type\Line;
8-
use PhpOffice\PhpPresentation\Shape\Chart\Type\Pie3D;
9-
use PhpOffice\PhpPresentation\Shape\Chart\Type\Scatter;
107
use PhpOffice\PhpPresentation\Shape\Chart\Series;
11-
use PhpOffice\PhpPresentation\Style\Alignment;
128
use PhpOffice\PhpPresentation\Style\Border;
139
use PhpOffice\PhpPresentation\Style\Color;
1410
use PhpOffice\PhpPresentation\Style\Fill;
@@ -181,7 +177,17 @@
181177
$shape4->getPlotArea()->getAxisY()->setOutline($oOutlineAxisY);
182178
$currentSlide->addShape($shape4);
183179

180+
// Create templated slide
181+
echo EOL . date('H:i:s') . ' Create templated slide' . EOL;
182+
$currentSlide = createTemplatedSlide($objPHPPresentation);
184183

184+
// Create a shape (chart)
185+
echo date('H:i:s') . ' Create a shape (chart5)' . EOL;
186+
echo date('H:i:s') . ' Feature : Gridlines' . EOL;
187+
$shape5 = clone $shape;
188+
$shape5->getPlotArea()->getAxisY()->setMinBounds(5);
189+
$shape5->getPlotArea()->getAxisY()->setMaxBounds(20);
190+
$currentSlide->addShape($shape5);
185191
// Save file
186192
echo EOL . write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
187193

0 commit comments

Comments
 (0)