Skip to content

Commit

Permalink
Merge pull request #2 from PHPOffice/develop
Browse files Browse the repository at this point in the history
Sync
  • Loading branch information
patrickbrouwers authored Feb 22, 2017
2 parents d97f9c8 + 6da9d8a commit bf37cae
Show file tree
Hide file tree
Showing 398 changed files with 1,881 additions and 1,311 deletions.
35 changes: 22 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

0.13.0 (unreleased)
v0.13.0 (31 July 2016)
-------------------
Place announcement text here.
This release brings several improvements in `TemplateProcessor`, automatic output escaping feature for OOXML, ODF, HTML, and RTF (turned off, by default).
It also introduces constants for horizontal alignment options, and resolves some issues with PHP 7.
Manual installation feature has been dropped since the release. Please, use [Composer](https://getcomposer.org/) to install PHPWord.

### Added
- Introduced the `\PhpOffice\PhpWord\SimpleType\Jc` simple type. - @RomanSyroeshko
- Introduced the `\PhpOffice\PhpWord\SimpleType\JcTable` simple type. - @RomanSyroeshko
- Introduced writer for the "Paragraph Alignment" element (see `\PhpOffice\PhpWord\Writer\Word2007\Element\ParagraphAlignment`). - @RomanSyroeshko
- Introduced writer for the "Table Alignment" element (see `\PhpOffice\PhpWord\Writer\Word2007\Element\TableAlignment`). - @RomanSyroeshko
- Supported indexed arrays in arguments of `TemplateProcessor::setValue()`. - @RomanSyroeshko #618
- Introduced automatic output escaping for OOXML, ODF, HTML, and RTF. To turn the feature on use `phpword.ini` or `\PhpOffice\PhpWord\Settings`. - @RomanSyroeshko #483
- Supported processing of headers and footers in `TemplateProcessor::applyXslStyleSheet()`. - @RomanSyroeshko #335

### Changed
- Improved error message for the case when `autoload.php` is not found. - @RomanSyroeshko #371
Expand All @@ -23,6 +28,7 @@ Place announcement text here.
Use the correspondent `getAlignment` and `setAlignment` methods instead. - @RomanSyroeshko
- `left`, `right`, and `justify` alignment options for paragraphs (now are mapped to `Jc::START`, `Jc::END`, and `Jc::BOTH`). - @RomanSyroeshko
- `left`, `right`, and `justify` alignment options for tables (now are mapped to `Jc::START`, `Jc::END`, and `Jc::CENTER`). - @RomanSyroeshko
- `TCPDF` due to its limited HTML support. Use `DomPDF` or `MPDF` writer instead. - @RomanSyroeshko #399

### Removed
- `\PhpOffice\PhpWord\Style\Alignment`. Style properties, which previously stored instances of this class, now deal with strings.
Expand All @@ -36,13 +42,16 @@ so installation via ZIP-archive download is not an option anymore. To install PH
- `\PhpOffice\PhpWord\Shared\String` replaced by `\PhpOffice\Common\Text`. - @Progi1984 @RomanSyroeshko #658
- `\PhpOffice\PhpWord\Shared\XMLReader` replaced by `\PhpOffice\Common\XMLReader`. - @Progi1984 #658
- `\PhpOffice\PhpWord\Shared\XMLWriter` replaced by `\PhpOffice\Common\XMLWriter`. - @Progi1984 @RomanSyroeshko #658
- `AbstractContainer::addMemoryImage()`. Use `AbstractContainer::addImage()` instead.

### Fixed
- `Undefined property` error while reading MS-DOC documents. - @jaberu #610
- Corrupted OOXML template issue in case when its names is broken immediately after `$` sign.
That case wasn't taken into account in implementation of `TemplateProcessor::fixBrokenMacros()`. - @RomanSyroeshko @d-damien #548



0.12.1 (30 August 2015)
v0.12.1 (30 August 2015)
-----------------------
Maintenance release. This release is focused primarily on `TemplateProcessor`.

Expand All @@ -56,7 +65,7 @@ Maintenance release. This release is focused primarily on `TemplateProcessor`.



0.12.0 (3 January 2015)
v0.12.0 (3 January 2015)
-----------------------
This release added form fields (textinput, checkbox, and dropdown), drawing shapes (arc, curve, line, polyline, rect, oval), and basic 2D chart (pie, doughnut, bar, line, area, scatter, radar) elements along with some new styles. Basic MsDoc reader is introduced.

Expand Down Expand Up @@ -115,15 +124,15 @@ This release added form fields (textinput, checkbox, and dropdown), drawing shap



0.11.1 (2 June 2014)
v0.11.1 (2 June 2014)
--------------------
This is an immediate bugfix release for HTML reader.

- HTML Reader: `<p>` and header tags puts no output - @canyildiz @ivanlanin #257



0.11.0 (1 June 2014)
v0.11.0 (1 June 2014)
--------------------
This release marked the change of PHPWord license from LGPL 2.1 to LGPL 3. Four new elements were added: TextBox, ListItemRun, Field, and Line. Relative and absolute positioning for images and textboxes were added. Writer classes were refactored into parts, elements, and styles. ODT and RTF features were enhanced. Ability to add elements to PHPWord object via HTML were implemented. RTF and HTML reader were initiated.

Expand Down Expand Up @@ -187,15 +196,15 @@ This release marked the change of PHPWord license from LGPL 2.1 to LGPL 3. Four



0.10.1 (21 May 2014)
v0.10.1 (21 May 2014)
--------------------
This is a bugfix release for `php-zip` requirement in Composer.

- Change Composer requirements for php-zip from `require` to `suggest` - @bskrtich #246



0.10.0 (4 May 2014)
v0.10.0 (4 May 2014)
-------------------
This release marked heavy refactorings on internal code structure with the creation of some abstract classes to reduce code duplication. `Element` subnamespace is introduced in this release to replace `Section`. Word2007 reader capability is greatly enhanced. Endnote is introduced. List numbering is now customizable. Basic HTML and PDF writing support is enabled. Basic ODText reader is introduced.

Expand Down Expand Up @@ -279,15 +288,15 @@ This release marked heavy refactorings on internal code structure with the creat



0.9.1 (27 Mar 2014)
v0.9.1 (27 Mar 2014)
-------------------
This is a bugfix release for PSR-4 compatibility.

- Fixed PSR-4 composer autoloader - @AntonTyutin



0.9.0 (26 Mar 2014)
v0.9.0 (26 Mar 2014)
-------------------
This release marked the transformation to namespaces (PHP 5.3+).

Expand All @@ -309,15 +318,15 @@ This release marked the transformation to namespaces (PHP 5.3+).



0.8.1 (17 Mar 2014)
v0.8.1 (17 Mar 2014)
-------------------
This is a bugfix release for image detection functionality.

- Added fallback for computers that do not have exif_imagetype - @bskrtich, @gabrielbull



0.8.0 (15 Mar 2014)
v0.8.0 (15 Mar 2014)
-------------------
This release merged a lot of improvements from the community. Unit tests introduced in this release and has reached 90% code coverage.

Expand Down Expand Up @@ -365,7 +374,7 @@ This release merged a lot of improvements from the community. Unit tests introdu



0.7.0 (28 Jan 2014)
v0.7.0 (28 Jan 2014)
-------------------
This is the first release after a long development hiatus in [CodePlex](https://phpword.codeplex.com/). This release initialized ODT and RTF Writer, along with some other new features for the existing Word2007 Writer, e.g. tab, multiple header, rowspan and colspan. [Composer](https://packagist.org/packages/phpoffice/phpword) and [Travis](https://travis-ci.org/PHPOffice/PHPWord) were added.

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PHPWord, a pure PHP library for reading and writing word processing documents.

Copyright (c) 2010-2015 PHPWord.
Copyright (c) 2010-2016 PHPWord.

PHPWord is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3 as published by
Expand Down
41 changes: 17 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Read more about PHPWord:

## Features

With PHPWord, you can create DOCX, ODT, or RTF documents dynamically using your PHP 5.3+ scripts. Below are some of the things that you can do with PHPWord library:
With PHPWord, you can create OOXML, ODF, or RTF documents dynamically using your PHP 5.3.3+ scripts. Below are some of the things that you can do with PHPWord library:

- Set document properties, e.g. title, subject, and creator.
- Create document sections with different settings, e.g. portrait/landscape, page size, and page numbering
Expand All @@ -45,19 +45,21 @@ With PHPWord, you can create DOCX, ODT, or RTF documents dynamically using your
- Insert charts (pie, doughnut, bar, line, area, scatter, radar)
- Insert form fields (textinput, checkbox, and dropdown)
- Create document from templates
- Use XSL 1.0 style sheets to transform main document part of OOXML template
- Use XSL 1.0 style sheets to transform headers, main document part, and footers of an OOXML template
- ... and many more features on progress

## Requirements

PHPWord requires the following:

- PHP 5.3+
- PHP 5.3.3+
- [XML Parser extension](http://www.php.net/manual/en/xml.installation.php)
- [Zend\Escaper component](http://framework.zend.com/manual/current/en/modules/zend.escaper.introduction.html)
- Zend\Stdlib component
- [Zend\Validator component](http://framework.zend.com/manual/current/en/modules/zend.validator.html)
- [Zip extension](http://php.net/manual/en/book.zip.php) (optional, used to write DOCX and ODT)
- [Zip extension](http://php.net/manual/en/book.zip.php) (optional, used to write OOXML and ODF)
- [GD extension](http://php.net/manual/en/book.image.php) (optional, used to add images)
- [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php) (optional, used to write DOCX and ODT)
- [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php) (optional, used to write OOXML and ODF)
- [XSL extension](http://php.net/manual/en/book.xsl.php) (optional, used to apply XSL style sheet to template )
- [dompdf library](https://github.com/dompdf/dompdf) (optional, used to write PDF)

Expand Down Expand Up @@ -93,11 +95,9 @@ $phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
// Adding Text element to the Section having font styled by default...
$section->addText(
htmlspecialchars(
'"Learn from yesterday, live for today, hope for tomorrow. '
. 'The important thing is not to stop questioning." '
. '(Albert Einstein)'
)
'"Learn from yesterday, live for today, hope for tomorrow. '
. 'The important thing is not to stop questioning." '
. '(Albert Einstein)'
);

/*
Expand All @@ -109,11 +109,9 @@ $section->addText(

// Adding Text element with font customized inline...
$section->addText(
htmlspecialchars(
'"Great achievement is usually born of great sacrifice, '
. 'and is never the result of selfishness." '
. '(Napoleon Hill)'
),
'"Great achievement is usually born of great sacrifice, '
. 'and is never the result of selfishness." '
. '(Napoleon Hill)',
array('name' => 'Tahoma', 'size' => 10)
);

Expand All @@ -124,11 +122,9 @@ $phpWord->addFontStyle(
array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true)
);
$section->addText(
htmlspecialchars(
'"The greatest accomplishment is not in never falling, '
. 'but in rising again after you fall." '
. '(Vince Lombardi)'
),
'"The greatest accomplishment is not in never falling, '
. 'but in rising again after you fall." '
. '(Vince Lombardi)',
$fontStyleName
);

Expand All @@ -137,9 +133,7 @@ $fontStyle = new \PhpOffice\PhpWord\Style\Font();
$fontStyle->setBold(true);
$fontStyle->setName('Tahoma');
$fontStyle->setSize(13);
$myTextElement = $section->addText(
htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)')
);
$myTextElement = $section->addText('"Believe you can and you\'re halfway there." (Theodor Roosevelt)');
$myTextElement->setFontStyle($fontStyle);

// Saving the document as OOXML file...
Expand All @@ -157,7 +151,6 @@ $objWriter->save('helloWorld.html');
/* Note: we skip RTF, because it's not XML-based and requires a different example. */
/* Note: we skip PDF, because "HTML-to-PDF" approach is used to create PDF documents. */
```
:warning: Escape any string you pass to OOXML/ODF/HTML document, otherwise it may get broken.

More examples are provided in the [samples folder](samples/). You can also read the [Developers' Documentation](http://phpword.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/master/) for more detail.

Expand Down
2 changes: 1 addition & 1 deletion bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2015 PHPWord contributors
* @copyright 2010-2016 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/

Expand Down
22 changes: 10 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "phpoffice/phpword",
"description": "PHPWord - A pure PHP library for reading and writing word processing documents (DOCX, ODT, RTF, HTML, PDF)",
"description": "PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)",
"keywords": [
"PHP", "PhpOffice", "office", "PhpWord", "word", "template", "template processor", "reader", "writer",
"PHP", "PHPOffice", "office", "PHPWord", "word", "template", "template processor", "reader", "writer",
"docx", "OOXML", "OpenXML", "Office Open XML", "ISO IEC 29500", "WordprocessingML",
"RTF", "Rich Text Format", "doc", "odt", "OpenDocument", "PDF", "HTML"
"RTF", "Rich Text Format", "doc", "odt", "ODF", "OpenDocument", "PDF", "HTML"
],
"homepage": "http://phpoffice.github.io",
"type": "library",
Expand Down Expand Up @@ -34,8 +34,9 @@
"require": {
"php": ">=5.3.3",
"ext-xml": "*",
"zendframework/zend-validator": "2.5.*",
"zendframework/zend-stdlib": "~2.5",
"zendframework/zend-escaper": "2.4.*",
"zendframework/zend-stdlib": "2.4.*",
"zendframework/zend-validator": "2.4.*",
"phpoffice/common": "0.2.*"
},
"require-dev": {
Expand All @@ -46,16 +47,13 @@
"phploc/phploc": "2.*",
"dompdf/dompdf":"0.6.*",
"tecnickcom/tcpdf": "6.*",
"mpdf/mpdf": "5.*",
"zendframework/zend-validator": "2.5.*",
"zendframework/zend-stdlib": "~2.5",
"phpoffice/common": "0.2.*"
"mpdf/mpdf": "5.*"
},
"suggest": {
"ext-zip": "Allows writing DOCX and ODT",
"ext-zip": "Allows writing OOXML and ODF",
"ext-gd2": "Allows adding images",
"ext-xmlwriter": "Allows writing DOCX and ODT",
"ext-xsl": "Allows applying XSL style sheet to main document part of OOXML template",
"ext-xmlwriter": "Allows writing OOXML and ODF",
"ext-xsl": "Allows applying XSL style sheet to headers, to main document part, and to footers of an OOXML template",
"dompdf/dompdf": "Allows writing PDF"
},
"autoload": {
Expand Down
4 changes: 3 additions & 1 deletion docs/elements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ To add an image, use the ``addImage`` method to sections, headers, footers, text
$section->addImage($src, [$style]);
- ``$src``. String path to a local image or URL of a remote image.
- ``$src``. String path to a local image, URL of a remote image or the image data, as a string.
- ``$style``. See :ref:`image-style`.

Examples:
Expand All @@ -254,6 +254,8 @@ Examples:
$footer->addImage('http://example.com/image.php');
$textrun = $section->addTextRun();
$textrun->addImage('http://php.net/logo.jpg');
$source = file_get_contents('/path/to/my/images/earth.jpg');
$textrun->addImage($source);
Watermarks
~~~~~~~~~~
Expand Down
Loading

0 comments on commit bf37cae

Please sign in to comment.