Skip to content

Commit

Permalink
Merge pull request #350 from PHPOffice/develop
Browse files Browse the repository at this point in the history
Release 0.8.0
  • Loading branch information
Progi1984 authored Apr 3, 2017
2 parents 4f40d93 + 179aed2 commit 14b52bd
Show file tree
Hide file tree
Showing 97 changed files with 5,050 additions and 4,241 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ php:
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm

matrix:
allow_failures:
- php: 7.1
- php: hhvm

env:
Expand Down
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Changelog

## 0.8.0 - 2017-04-03

### Bugfix
- PowerPoint2007 Writer : Fixed the marker on line chart when symbol is none - @Napryc GH-211
- PowerPoint2007 Writer : Fixed the format value in Pie Chart - @Napryc GH-212
- PowerPoint2007 Writer : The presentation need repairs on Mac @jrking4 GH-266 GH-276
- PowerPoint2007 Writer : Fix for PowerPoint2007 Writer (Need repair) @Progi1984 GH-266 GH-274 GH-276 GH-282 GH-302
- PowerPoint2007 Writer : Fixed the axis title in bar chart - @pgee70 GH-267
- PowerPoint2007 Writer : Fixed the label position in bar chart - @pgee70 GH-268
- PowerPoint2007 Writer : Support of margins in cell in table - @carlosafonso @Progi1984 GH-273 GH-315
- Fixed the corruption of file when an addExternalSlide is called - @Progi1984 GH-240

### Changes
- Misc : Added two methods for setting Border & Fill in Legend - @Progi1984 GH-265

### Features
- ODPresentation Writer : Show/Hide Value / Name / Series Name in Chart - @Progi1984 GH-272
- ODPresentation Writer : Axis Bounds in Chart - @Progi1984 GH-269
- PowerPoint97 Reader : Support of Slide Note - @Progi1984 GH-226
- PowerPoint2007 Reader : Support of Shape Table - @Progi1984 GH-240
- PowerPoint2007 Reader : Support of Slide Note - @Progi1984 GH-226
- PowerPoint2007 Reader : Support text direction in Alignment for Table - @Progi1984 GH-218
- PowerPoint2007 Writer : Implement character spacing - @jvanoostrom GH-301
- PowerPoint2007 Writer : Axis Bounds in Chart - @Progi1984 GH-269
- PowerPoint2007 Writer : Implement Legend Key in Series for Chart - @Progi1984 GH-319
- PowerPoint2007 Writer : Support text direction in Alignment for Table - @SeregPie GH-218
- PowerPoint2007 Writer : Support tick mark & unit in Axis for Chart - @Faab GH-218
- PowerPoint2007 Writer : Support separator in Series for Chart - @jphchaput GH-218
- PowerPoint2007 Writer : Add support for Outline in Axis - @Progi1984 GH-255
- PowerPoint2007 Writer : Support autoscale for Chart - @Progi1984 GH-293

## 0.7.0 - 2016-09-12

### Bugfix
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# ![PHPPresentation](https://raw.githubusercontent.com/mvargasmoran/PHPPresentation/develop/docs/images/PHPPresentationLogo.png "PHPPresentation")

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

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)
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)

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).

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

### Installation

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpdocumentor/phpdocumentor":"2.*",
"twig/twig":"1.27",
"phpmd/phpmd": "2.*",
"sebastian/phpcpd": "2.*",
"phploc/phploc": "2.*",
Expand Down
16 changes: 8 additions & 8 deletions docs/readers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ The name of the reader is ``ODPresentation``.

.. code-block:: php
$oWriter = IOFactory::createReader('ODPresentation');
$oWriter->load(__DIR__ . '/sample.odp');
$oReader = IOFactory::createReader('ODPresentation');
$oReader->load(__DIR__ . '/sample.odp');
PowerPoint97
------------
Expand All @@ -20,8 +20,8 @@ The name of the reader is ``PowerPoint97``.

.. code-block:: php
$oWriter = IOFactory::createReader('PowerPoint97');
$oWriter->load(__DIR__ . '/sample.ppt');
$oReader = IOFactory::createReader('PowerPoint97');
$oReader->load(__DIR__ . '/sample.ppt');
PowerPoint2007
--------------
Expand All @@ -30,8 +30,8 @@ The name of the reader is ``PowerPoint2007``.

.. code-block:: php
$oWriter = IOFactory::createReader('PowerPoint2007');
$oWriter->load(__DIR__ . '/sample.pptx');
$oReader = IOFactory::createReader('PowerPoint2007');
$oReader->load(__DIR__ . '/sample.pptx');
Serialized
----------
Expand All @@ -40,5 +40,5 @@ The name of the reader is ``Serialized``.

.. code-block:: php
$oWriter = IOFactory::createReader('Serialized');
$oWriter->load(__DIR__ . '/sample.phppt');
$oReader = IOFactory::createReader('Serialized');
$oReader->load(__DIR__ . '/sample.phppt');
75 changes: 75 additions & 0 deletions docs/shapes_chart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,59 @@ For each gridline, you can custom the width (in points), the fill type and the f
$oShape->getPlotArea()->setType($oLine);
$oShape->getPlotArea()->getAxisX()->setMajorGridlines($oGridLines);
For Axis, you can define the min & max bounds with `setMinBounds` & `setMaxBounds` methods.
For resetting them, you pass null as parameter to these methods.

.. code-block:: php
use \PhpOffice\PhpPresentation\Shape\Chart\Gridlines;
$oLine = new Line();
$oShape = $oSlide->createChartShape();
$oShape->getPlotArea()->setType($oLine);
$oShape->getPlotArea()->getAxisX()->setMinBounds(0);
$oShape->getPlotArea()->getAxisX()->setMaxBounds(200);
You can define outline for each axis (X & Y).

.. code-block:: php
$oLine = new Line();
$oShape = $oSlide->createChartShape();
$oShape->getPlotArea()->setType($oLine);
$oShape->getPlotArea()->getAxisX()->getOutline()->setWidth(10);
$oShape->getPlotArea()->getAxisX()->getOutline()->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color(Color::COLOR_BLUE));
For Axis Y, you can define tick mark with `setMinorTickMark` & `setMajorTickMark` methods.
For resetting them, you pass Axis::TICK_MARK_NONE as parameter to these methods.

.. code-block:: php
use \PhpOffice\PhpPresentation\Shape\Chart\Axis;
$oLine = new Line();
$oShape = $oSlide->createChartShape();
$oShape->getPlotArea()->setType($oLine);
$oShape->getPlotArea()->getAxisY()->setMinorTickMark(Axis::TICK_MARK_NONE);
$oShape->getPlotArea()->getAxisY()->setMajorTickMark(Axis::TICK_MARK_INSIDE);
For Axis Y, you can define unit with `setMinorUnit` & `setMajorUnit` methods.
For resetting them, you pass null as parameter to these methods.

.. code-block:: php
use \PhpOffice\PhpPresentation\Shape\Chart\Axis;
$oLine = new Line();
$oShape = $oSlide->createChartShape();
$oShape->getPlotArea()->setType($oLine);
$oShape->getPlotArea()->getAxisY()->setMinorUnit(null);
$oShape->getPlotArea()->getAxisY()->setMajorUnit(0.05);
Title
^^^^^

Expand Down Expand Up @@ -90,6 +143,28 @@ Each position is described in `MSDN <https://msdn.microsoft.com/en-us/library/mt
$oSeries = new Series('Downloads', $seriesData);
$oSeries->setLabelPosition(Series::LABEL_INSIDEEND);
You can define if some informations are displayed.

.. code-block:: php
$oSeries = new Series('Downloads', $seriesData);
$oSeries->setSeparator(';');
$oSeries->setShowCategoryName(true);
$oSeries->setShowLeaderLines(true);
$oSeries->setShowLegendKey(true);
$oSeries->setShowPercentage(true);
$oSeries->setShowSeriesName(true);
$oSeries->setShowValue(true);
View3D
^^^^^^

For enabling the autoscale for a shape, you must reset the height percent.

.. code-block:: php
$oShape->getView3D()->setHeightPercent(null);
Types
-----

Expand Down
37 changes: 34 additions & 3 deletions docs/shapes_table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You can access cell objects with `nextCell` method of a Row object.
// Get the second cell
$cellA2 = $row->nextCell();
You can access cell object directly
You can access cell object directly.

.. code-block:: php
Expand All @@ -46,14 +46,45 @@ You can access cell object directly
$cellA1 = $row->getCell(0);
// Get the second cell
$cellA2 = $row->getCell(1);
Define margins of a cell
~~~~~~~~~~~~~~~~~~~~~~~~
Margins of cells are defined by margins of the first paragraph of cell.

For defining margins of cell, you can use the `setMargin*` method of a Alignment object of the active paragraph of a Cell object.

.. code-block:: php
$tableShape = $slide->createTableShape($columns);
$row = $tableShape->createRow();
$cellA1 = $row->nextCell();
$cellA1->getActiveParagraph()->getAlignment()
->setMarginBottom(20)
->setMarginLeft(40)
->setMarginRight(60)
->setMarginTop(80);
Define the text direction of a cell
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For defining the text direction of cell, you can use the `setTextDirection` method of the `getAlignment` method of a Cell object.
The width is in pixels.

.. code-block:: php
$tableShape = $slide->createTableShape($columns);
$row = $tableShape->createRow();
$cellA1 = $row->nextCell();
$cellA1->getAlignment()->setTextDirection(\PhpOffice\PhpPresentation\Style\Alignment::TEXT_DIRECTION_VERTICAL_270);
Define the width of a cell
~~~~~~~~~~~~~~~~~~~~~~~~~~
The width of cells are defined by the width of cell of the first row.
If not defined, all cells widths are calculated from the width of the shape and the number of columns.

For defining the width of cell, you can use the `setWidth` method of a Cell object.
For defining the width of cell, you can use the `setWidth` method of a Cell object.
The width is in pixels.

.. code-block:: php
Expand Down
2 changes: 1 addition & 1 deletion phpmd.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!-- PptSlides needs more coupling (default: 13) -->
<!-- Writer/Office2007/AbstractSlide needs more coupling (default: 13) -->
<properties>
<property name="minimum" value="31" />
<property name="minimum" value="35" />
</properties>
</rule>
<rule ref="rulesets/design.xml/NumberOfChildren">
Expand Down
8 changes: 8 additions & 0 deletions samples/Sample_04_Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
$cell->getBorders()->getBottom()->setLineWidth(4)
->setLineStyle(Border::LINE_SINGLE)
->setDashStyle(Border::DASH_DASH);
$cell->getActiveParagraph()->getAlignment()
->setMarginLeft(10);

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

Expand All @@ -76,6 +79,9 @@
->setStartColor(new Color('FFE06B20'))
->setEndColor(new Color('FFE06B20'));
$row->nextCell()->createTextRun('R2C1');
$row->getCell()->getActiveParagraph()->getAlignment()
->setMarginLeft(30)
->setTextDirection(\PhpOffice\PhpPresentation\Style\Alignment::TEXT_DIRECTION_VERTICAL_270);
$row->nextCell()->createTextRun('R2C2');
$row->nextCell()->createTextRun('R2C3');

Expand All @@ -86,6 +92,7 @@
->setStartColor(new Color('FFE06B20'))
->setEndColor(new Color('FFE06B20'));
$row->nextCell()->createTextRun('R3C1');
$row->getCell()->getActiveParagraph()->getAlignment()->setMarginLeft(40);
$row->nextCell()->createTextRun('R3C2');
$row->nextCell()->createTextRun('R3C3');

Expand All @@ -98,6 +105,7 @@
$cellC1 = $row->nextCell();
$textRunC1 = $cellC1->createTextRun('Link');
$textRunC1->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation');
$cellC1->getActiveParagraph()->getAlignment()->setMarginLeft(50);
$cellC2 = $row->nextCell();
$textRunC2 = $cellC2->createTextRun('RichText with');
$textRunC2->getFont()->setBold(true);
Expand Down
13 changes: 8 additions & 5 deletions samples/Sample_05_Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
use PhpOffice\PhpPresentation\Style\Color;
use PhpOffice\PhpPresentation\Style\Fill;
use PhpOffice\PhpPresentation\Style\Shadow;
use PhpOffice\PhpPresentation\Style\PhpOffice\PhpPresentation\Style;

function fnSlide_Area(PhpPresentation $objPHPPresentation) {
global $oFill;
global $oShadow;

// Generate sample data for chart
echo date('H:i:s') . ' Generate sample data for chart' . EOL;
$seriesData = array(
Expand All @@ -33,11 +32,11 @@ function fnSlide_Area(PhpPresentation $objPHPPresentation) {
'Saturday' => 9,
'Sunday' => 7
);

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

// Create a line chart (that should be inserted in a shape)
echo date('H:i:s') . ' Create a area chart (that should be inserted in a chart shape)' . EOL;
$areaChart = new Area();
Expand All @@ -47,7 +46,7 @@ function fnSlide_Area(PhpPresentation $objPHPPresentation) {
$series->getFill()->setStartColor(new Color('FF93A9CE'));
$series->setLabelPosition(Series::LABEL_INSIDEEND);
$areaChart->addSeries($series);

// Create a shape (chart)
echo date('H:i:s') . ' Create a shape (chart)' . EOL;
$shape = $currentSlide->createChartShape();
Expand All @@ -59,6 +58,8 @@ function fnSlide_Area(PhpPresentation $objPHPPresentation) {
$shape->getTitle()->setText('PHPPresentation Daily Downloads');
$shape->getTitle()->getFont()->setItalic(true);
$shape->getPlotArea()->setType($areaChart);
$shape->getPlotArea()->getAxisX()->setTitle('Axis X');
$shape->getPlotArea()->getAxisY()->setTitle('Axis Y');
$shape->getView3D()->setRotationX(30);
$shape->getView3D()->setPerspective(30);
$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE);
Expand Down Expand Up @@ -90,6 +91,7 @@ function fnSlide_Bar(PhpPresentation $objPHPPresentation) {
$series2->setShowSeriesName(true);
$series2->getFont()->getColor()->setRGB('FF0000');
$series2->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFC0504D'));
$series2->setLabelPosition(Series::LABEL_INSIDEEND);
$barChart->addSeries($series1);
$barChart->addSeries($series2);

Expand Down Expand Up @@ -457,6 +459,7 @@ function fnSlide_Pie(PhpPresentation $objPHPPresentation) {
$series->setShowValue( false );
$series->setShowSeriesName( false );
$series->setShowCategoryName( true );
$series->setDlblNumFormat('%d');
$pieChart->addSeries($series);

// Create a shape (chart)
Expand Down
Loading

0 comments on commit 14b52bd

Please sign in to comment.