Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
adfcc62
imagesavealpha() in Writer\AbstractWriter
samsullivan Apr 11, 2016
f4ec74a
imagesavealpha() in Element\Image
samsullivan Apr 11, 2016
133b727
table->setStretch() optionally avoids the table to stretch to the pag…
aoloe Jul 25, 2016
99b04f0
fix reading of docx default style (#1238)
troosan Jan 12, 2018
4c68ebb
Parse formatting inside HTML lists (#1239)
mussbach Jan 13, 2018
8ed3cac
Refactoring
carusogabriel Jan 16, 2018
0425a25
Add parsing of HTML links
troosan Jan 25, 2018
4f6fa50
Merge pull request #1258 from troosan/parse_html_links
troosan Jan 26, 2018
30183e2
fix typo in comment
nicoder Jan 26, 2018
9a91d54
Merge pull request #1259 from nicoder/patch-1
troosan Jan 30, 2018
caba7e2
Delete VERSION
lalop Jan 31, 2018
8a9a478
add (failing) test and correct documentation sample to valid HTML
mussbach Feb 1, 2018
e0096db
fix typo in test method name
mussbach Feb 1, 2018
1813e2d
Merge pull request #1266 from samimussbach/fixTypoInTest
troosan Feb 2, 2018
edd9617
fix typo
nicoder Feb 4, 2018
4308ce9
Merge pull request #1271 from nicoder/patch-2
troosan Feb 4, 2018
cf6319d
Merge pull request #1264 from lalop/patch-1
troosan Feb 4, 2018
46a5f96
fix parsing of table and p inside table cells
troosan Feb 6, 2018
47c837a
add unit tests
troosan Feb 6, 2018
46476d7
update phpdoc
troosan Feb 7, 2018
33739ea
cannot add list on textrun
troosan Feb 7, 2018
304173c
fix nested list
troosan Feb 8, 2018
c0ed4ab
Merge remote-tracking branch 'samimussbach/PHPWord/fixNestedLists' in…
troosan Feb 8, 2018
24f3463
remove output
troosan Feb 8, 2018
fd127ef
Merge pull request #779 from samsullivan/imagesavealpha
troosan Feb 9, 2018
9cd5ab7
update changelog
troosan Feb 9, 2018
604e60c
Add support for Track changes (#1262)
troosan Feb 9, 2018
5b381bc
Merge branch 'develop' into various_html_parsing_fixes
troosan Feb 9, 2018
3f40c5e
Merge pull request #1273 from troosan/various_html_parsing_fixes
troosan Feb 9, 2018
91a8dd3
add parsing of p:br and add unit test
troosan Feb 10, 2018
874c6d6
update changelog
troosan Feb 10, 2018
b868c33
Merge pull request #1277 from troosan/fix_parsing_of_textbreaks
troosan Feb 10, 2018
377fb99
Add HTML writer for Bookmarks + tests
troosan Feb 10, 2018
5ff15e0
update testing instructions
troosan Feb 10, 2018
ee95cf3
Merge pull request #1278 from troosan/fix_internal_links_in_html_output
troosan Feb 10, 2018
e846602
fix null check
troosan Feb 11, 2018
7ddaed2
table->setStretch() optionally avoids the table to stretch to the pag…
aoloe Jul 25, 2016
615c1d5
Merge branch 'stretch-table' of https://github.com/aoloe/php-PHPWord
troosan Feb 13, 2018
6a926e2
refactor attribute name to layout, add doc and tests
troosan Feb 13, 2018
99d8b52
Merge pull request #1281 from troosan/add_table_layout
troosan Feb 14, 2018
e7232a7
Use singular form of twip
Trainmaster Feb 16, 2018
ab97835
Use same markup for describing unit of measurement
Trainmaster Feb 16, 2018
fede4f7
Add missing unit of measurement descriptions
Trainmaster Feb 16, 2018
d061c6d
Remove zend-stdlib dependency
Trainmaster Feb 15, 2018
7324070
Merge pull request #1284 from Trainmaster/feature-remove-zend-stdlib-…
troosan Feb 17, 2018
cc57eb9
Merge pull request #1286 from meteocontrol/feature-consistent-twip-na…
troosan Feb 17, 2018
ba03518
point next dev version to develop branch
troosan Feb 17, 2018
04d0c02
Add support for cellSpacing for tables (#1040)
dox07 Feb 17, 2018
bded91a
Footnote in listitem (#1289)
troosan Feb 17, 2018
def0237
Merge pull request #1248 from carusogabriel/patch-1
troosan Feb 18, 2018
59de019
Fix listitem parsing (#1290)
troosan Feb 18, 2018
f3c73f3
Fix HTML parsing when style attribute is empty (#1295)
lalop Feb 27, 2018
7fe32e6
Add support for MACROBUTTON Field (#1021)
phryneas Feb 27, 2018
740e66a
randomize the tempDir more
troosan Mar 2, 2018
30b224b
Word2007 parsing title formatting (#1297)
troosan Mar 6, 2018
250fbd4
Added support for Vertically Raised or Lowered Text (w:position) (#1294)
troosan Mar 6, 2018
6a64979
Allow to set "autoHyphenation" setting (#1282)
Trainmaster Mar 6, 2018
f41c542
Enforce valid value for on/off type
Trainmaster Feb 15, 2018
edc3aa3
Improve assertions
Trainmaster Feb 15, 2018
9ffbd98
Add missing tests
Trainmaster Feb 15, 2018
d8f4a28
Make Composer scripts compatible with Windows
Trainmaster Mar 7, 2018
9affbf4
Merge pull request #1306 from Trainmaster/feature-make-composer-scrip…
troosan Mar 7, 2018
eb69009
Added new constant to Brazilian portuguese language
franciscosens Mar 8, 2018
f9a0554
Added support for Floating Table Positioning (tblpPr) (#639)
anrikun Mar 8, 2018
77f2b16
update copyright to 2018
troosan Mar 8, 2018
8bafe00
Merge pull request #1307 from franciscosens/add-suport-pt-br
troosan Mar 10, 2018
e29a3e7
add text wrapping distance
troosan Mar 11, 2018
a0111be
update changelog and doc
troosan Mar 11, 2018
6b48451
Merge pull request #1310 from troosan/add_image_wrap_distance
troosan Mar 11, 2018
3ce27cd
fetch the latest from upstream
Mar 14, 2018
7fa341f
accidentally removed a comment's end
Mar 14, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
build:
nodes:
analysis:
tests:
override: [php-scrutinizer-run]
filter:
excluded_paths: [ 'vendor/*', 'tests/*', 'samples/*', 'src/PhpWord/Shared/PCLZip/*' ]

Expand Down
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ matrix:
include:
- php: 5.6
env: COVERAGE=1
allow_failures:
- php: 7.2

cache:
directories:
- vendor
- $HOME/.composer/cache
- .php-cs.cache

Expand All @@ -38,7 +35,7 @@ before_script:
- if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi
## Composer
- composer self-update
- composer install --prefer-source
- travis_wait composer install --prefer-source
## PHPDocumentor
- mkdir -p build/docs
- mkdir -p build/coverage
Expand Down
31 changes: 28 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,32 @@ This project adheres to [Semantic Versioning](http://semver.org/).
v0.15.0 (?? ??? 2018)
----------------------
### Added
- Parsing of "align" HTML attribute - @troosan #1231
- Parsing of `align` HTML attribute - @troosan #1231
- Parse formatting inside HTML lists - @troosan @samimussbach #1239 #945 #1215 #508
- Parsing of CSS `direction` instruction, HTML `lang` attribute, formatting inside table cell - @troosan #1273 #1252 #1254
- Add support for Track changes @Cip @troosan #354 #1262
- Add support for fixed Table Layout @aoloe @ekopach @troosan #841 #1276
- Add support for Cell Spacing @dox07 @troosan #1040
- Add parsing of formatting inside lists @atomicalnet @troosan #594
- Added support for Vertically Raised or Lowered Text (w:position) @anrikun @troosan #640
- Add support for MACROBUTTON field @phryneas @troosan #1021
- Add support for Hyphenation @Trainmaster #1282 (Document: `autoHyphenation`, `consecutiveHyphenLimit`, `hyphenationZone`, `doNotHyphenateCaps`, Paragraph: `suppressAutoHyphens`)
- Added support for Floating Table Positioning (tblpPr) @anrikun #639
- Added support for Image text wrapping distance @troosan #1310

### Fixed
- Fix reading of docx default style - @troosan #1238
- Fix the size unit of when parsing html images - @troosan #1254
- Fixed HTML parsing of nested lists - @troosan #1265
- Save PNG alpha information when using remote images. @samsullivan #779
- Fix parsing of `<w:br/>` tag. @troosan #1274
- Bookmark are not writton as internal link in html writer @troosan #1263
- It should be possible to add a Footnote in a ListItemRun @troosan #1287 #1287
- Fix parsing of Heading and Title formating @troosan @gthomas2 #465

### Changed
- Remove zend-stdlib dependency @Trainmaster #1284


v0.14.0 (29 Dec 2017)
----------------------
Expand Down Expand Up @@ -58,6 +81,8 @@ This version brings compatibility with PHP 7.0 & 7.1
### Deprecated
- PhpWord->getProtection(), get it from the settings instead PhpWord->getSettings()->getDocumentProtection();



v0.13.0 (31 July 2016)
-------------------
This release brings several improvements in `TemplateProcessor`, automatic output escaping feature for OOXML, ODF, HTML, and RTF (turned off, by default).
Expand All @@ -77,7 +102,7 @@ Manual installation feature has been dropped since the release. Please, use [Com
- Improved error message for the case when `autoload.php` is not found. - @RomanSyroeshko #371
- Renamed the `align` option of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles into `alignment`. - @RomanSyroeshko
- Improved performance of `TemplateProcessor::setValue()`. - @kazitanvirahsan #614, #617
- Fixed some HTML tags not rendering any output (p, header & table) - #257, #324 - @twmobius and @garethellis
- Fixed some HTML tags not rendering any output (p, header & table) - #257, #324 - @twmobius and @garethellis

### Deprecated
- `getAlign` and `setAlign` methods of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles.
Expand Down Expand Up @@ -455,4 +480,4 @@ This is the first release after a long development hiatus in [CodePlex](https://
- Basic CI with Travis - @Progi1984
- Added PHPWord_Exception and exception when could not copy the template - @Progi1984
- IMPROVED: Moved examples out of Classes directory - @Progi1984
- IMPROVED: Advanced string replace in setValue for Template - @Esmeraldo [#49](http://phpword.codeplex.com/workitem/49)
- IMPROVED: Advanced string replace in setValue for Template - @Esmeraldo [#49](http://phpword.codeplex.com/workitem/49)
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ We want to create a high quality document writer and reader library that people

- **Be brief, but be bold**. State your issues briefly. But speak out your ideas loudly, even if you can't or don't know how to implement it right away. The world will be better with limitless innovations.
- **Follow PHP-FIG standards**. We follow PHP Standards Recommendations (PSRs) by [PHP Framework Interoperability Group](http://www.php-fig.org/). If you're not familiar with these standards, please, [familiarize yourself now](https://github.com/php-fig/fig-standards). Also, please, use [PHPCodeSniffer](http://pear.php.net/package/PHP_CodeSniffer/) to validate your code against PSRs.
- **Test your code**. Nobody else knows your code better than you. So, it's completely yours mission to test the changes you made before pull request submission. We use [PHPUnit](https://phpunit.de/) for our testing purposes and recommend you using this tool too. [Here](https://phpunit.de/presentations.html) you can find PHPUnit best practices and additional information on effective unit testing, which helps us making PHPWord better day to day. Do not hesitate to smoke it carefully. It's a great investment in quality of your work, and it saves you years of life.
- **Test your code**. Nobody else knows your code better than you. So, it's completely your mission to test the changes you made before pull request submission. We use [PHPUnit](https://phpunit.de/) for our testing purposes and recommend you using this tool too. [Here](https://phpunit.de/presentations.html) you can find PHPUnit best practices and additional information on effective unit testing, which helps us making PHPWord better day to day. Do not hesitate to smoke it carefully. It's a great investment in quality of your work, and it saves you years of life.
- **Request pull in separate branch**. Do not submit your request to the master branch. But create a separate branch named specifically for the issue that you addressed. Read [GitHub manual](https://help.github.com/articles/using-pull-requests) to find out more about this. If you are new to GitHub, read [this short manual](https://help.github.com/articles/fork-a-repo) to get yourself familiar with forks and how git works in general. [This video](http://www.youtube.com/watch?v=-zvHQXnBO6c) explains how to synchronize your Github Fork with the Branch of PHPWord.

That's it. Thank you for your interest in PHPWord, and welcome!
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

PHPWord is a library written in pure PHP that provides a set of classes to write to and read from different document file formats. The current version of PHPWord supports Microsoft [Office Open XML](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML), OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF), [Rich Text Format](http://en.wikipedia.org/wiki/Rich_Text_Format) (RTF), HTML, and PDF.

PHPWord is an open source project licensed under the terms of [LGPL version 3](https://github.com/PHPOffice/PHPWord/blob/develop/COPYING.LESSER). PHPWord is aimed to be a high quality software product by incorporating [continuous integration](https://travis-ci.org/PHPOffice/PHPWord) and [unit testing](http://phpoffice.github.io/PHPWord/coverage/develop/). You can learn more about PHPWord by reading the [Developers' Documentation](http://phpword.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/develop/).
PHPWord is an open source project licensed under the terms of [LGPL version 3](https://github.com/PHPOffice/PHPWord/blob/develop/COPYING.LESSER). PHPWord is aimed to be a high quality software product by incorporating [continuous integration](https://travis-ci.org/PHPOffice/PHPWord) and [unit testing](http://phpoffice.github.io/PHPWord/coverage/develop/). You can learn more about PHPWord by reading the [Developers' Documentation](http://phpword.readthedocs.org/).

If you have any questions, please ask on [StackOverFlow](https://stackoverflow.com/questions/tagged/phpword)

Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

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
*
* @see https://github.com/PHPOffice/PHPWord
* @copyright 2010-2017 PHPWord contributors
* @copyright 2010-2018 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/

Expand Down
15 changes: 7 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@
],
"scripts": {
"test": [
"./vendor/bin/phpunit --color=always"
"phpunit --color=always"
],
"test-no-coverage": [
"./vendor/bin/phpunit --color=always --no-coverage"
"phpunit --color=always --no-coverage"
],
"check": [
"./vendor/bin/php-cs-fixer fix --ansi --dry-run --diff",
"./vendor/bin/phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n",
"./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php",
"php-cs-fixer fix --ansi --dry-run --diff",
"phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n",
"phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php",
"@test"
],
"fix": [
"./vendor/bin/php-cs-fixer fix --ansi"
"php-cs-fixer fix --ansi"
]
},
"scripts-descriptions": {
Expand All @@ -61,7 +61,6 @@
"php": "^5.3.3 || ^7.0",
"ext-xml": "*",
"zendframework/zend-escaper": "^2.2",
"zendframework/zend-stdlib": "^2.2 || ^3.0",
"phpoffice/common": "^0.2"
},
"require-dev": {
Expand Down Expand Up @@ -89,7 +88,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.15-dev"
"dev-develop": "0.15-dev"
}
}
}
4 changes: 2 additions & 2 deletions docs/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Fixes # (issue)

### Checklist:

- [ ] I have run `composer check` and no errors were reported
- [ ] The new code is covered by unit tests
- [ ] I have run `composer run-script check --timeout=0` and no errors were reported
- [ ] The new code is covered by unit tests (check build/coverage for coverage report)
- [ ] I have update the documentation to describe the changes
2 changes: 1 addition & 1 deletion docs/containers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Below are the properties of the line numbering style.

- ``start`` Line numbering starting value
- ``increment`` Line number increments
- ``distance`` Distance between text and line numbering in twip
- ``distance`` Distance between text and line numbering in *twip*
- ``restart`` Line numbering restart setting
continuous\|newPage\|newSection

Expand Down
62 changes: 48 additions & 14 deletions docs/elements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ column shows the containers while the rows lists the elements.
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 11 | Watermark | - | v | - | - | - | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 12 | Object | v | v | v | v | v | v |
| 12 | OLEObject | v | v | v | v | v | v |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
| 13 | TOC | v | - | - | - | - | - |
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
Expand Down Expand Up @@ -77,11 +77,19 @@ italics, etc) or other elements, e.g. images or links. The syntaxes are as follo

For available styling options see :ref:`font-style` and :ref:`paragraph-style`.

If you want to enable track changes on added text you can mark it as INSERTED or DELETED by a specific user at a given time:

.. code-block:: php

$text = $section->addText('Hello World!');
$text->setChanged(\PhpOffice\PhpWord\Element\ChangedElement::TYPE_INSERTED, 'Fred', (new \DateTime()));

Titles
~~~~~~

If you want to structure your document or build table of contents, you need titles or headings.
To add a title to the document, use the ``addTitleStyle`` and ``addTitle`` method.
If `depth` is 0, a Title will be inserted, otherwise a Heading1, Heading2, ...

.. code-block:: php

Expand All @@ -91,7 +99,7 @@ To add a title to the document, use the ``addTitleStyle`` and ``addTitle`` metho
- ``depth``.
- ``$fontStyle``. See :ref:`font-style`.
- ``$paragraphStyle``. See :ref:`paragraph-style`.
- ``$text``. Text to be displayed in the document.
- ``$text``. Text to be displayed in the document. This can be `string` or a `\PhpOffice\PhpWord\Element\TextRun`

It's necessary to add a title style to your document because otherwise the title won't be detected as a real title.

Expand Down Expand Up @@ -160,7 +168,7 @@ Parameters:
- ``$text``. Text that appears in the document.
- ``$depth``. Depth of list item.
- ``$fontStyle``. See :ref:`font-style`.
- ``$listStyle``. List style of the current element TYPE\_NUMBER,
- ``$listStyle``. List style of the current element TYPE\_NUMBER,
TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in PHPWord\\Style\\ListItem.
- ``$paragraphStyle``. See :ref:`paragraph-style`.

Expand Down Expand Up @@ -276,11 +284,11 @@ Objects
-------

You can add OLE embeddings, such as Excel spreadsheets or PowerPoint
presentations to the document by using ``addObject`` method.
presentations to the document by using ``addOLEObject`` method.

.. code-block:: php

$section->addObject($src, [$style]);
$section->addOLEObject($src, [$style]);

Table of contents
-----------------
Expand All @@ -300,16 +308,16 @@ Your TOC can only be generated if you have add at least one title (See "Titles")
Options for ``$tocStyle``:

- ``tabLeader``. Fill type between the title text and the page number. Use the defined constants in ``\PhpOffice\PhpWord\Style\TOC``.
- ``tabPos``. The position of the tab where the page number appears in twips.
- ``indent``. The indent factor of the titles in twips.
- ``tabPos``. The position of the tab where the page number appears in *twip*.
- ``indent``. The indent factor of the titles in *twip*.

Footnotes & endnotes
--------------------

You can create footnotes with ``addFootnote`` and endnotes with
``addEndnote`` in texts or textruns, but it's recommended to use textrun
to have better layout. You can use ``addText``, ``addLink``,
``addTextBreak``, ``addImage``, ``addObject`` on footnotes and endnotes.
``addTextBreak``, ``addImage``, ``addOLEObject`` on footnotes and endnotes.

On textrun:

Expand Down Expand Up @@ -345,15 +353,14 @@ The footnote numbering can be controlled by setting the FootnoteProperties on th
.. code-block:: php

$fp = new PhpWord\SimpleType\FootnoteProperties();
//sets the position of the footnote (pageBottom (default), beneathText, sectEnd, docEnd)
//sets the position of the footnote (pageBottom (default), beneathText, sectEnd, docEnd)
$fp->setPos(FootnoteProperties::POSITION_DOC_END);
//set the number format to use (decimal (default), upperRoman, upperLetter, ...)
$fp->setNumFmt(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN);
//force starting at other than 1
$fp->setNumStart(2);
//when to restart counting (continuous (default), eachSect, eachPage)
$fp->setNumRestart(FootnoteProperties::RESTART_NUMBER_EACH_PAGE);

//And finaly, set it on the Section
$section->setFootnoteProperties($properties);

Expand All @@ -379,7 +386,7 @@ To be completed
Fields
------

Currently the following fields are supported:
Currently the following fields are supported:

- PAGE
- NUMPAGES
Expand All @@ -406,8 +413,10 @@ For instance for the INDEX field, you can do the following (See `Index Field for
$fieldText->addText('My ');
$fieldText->addText('bold index', ['bold' => true]);
$fieldText->addText(' entry');
$section->addField('XE', array(), array(), $fieldText);

$section->addField('INDEX', array(), array('\\e " " \\h "A" \\c "3"'), $fieldText);
//this actually adds the index
$section->addField('INDEX', array(), array('\\e " " \\h "A" \\c "3"'), 'right click to update index');

Line
----
Expand All @@ -421,7 +430,7 @@ Line elements can be added to sections by using ``addLine``.

Available line style attributes:

- ``weight``. Line width in twips.
- ``weight``. Line width in *twip*.
- ``color``. Defines the color of stroke.
- ``dash``. Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot.
- ``beginArrow``. Start type of arrow: block, open, classic, diamond, oval.
Expand Down Expand Up @@ -464,4 +473,29 @@ The comment can contain formatted text. Once the comment has been added, it can
// link the comment to the text you just created
$text->setCommentStart($comment);

If no end is set for a comment using the ``setCommentEnd``, the comment will be ended automatically at the end of the element it is started on.
If no end is set for a comment using the ``setCommentEnd``, the comment will be ended automatically at the end of the element it is started on.

Track Changes
-------------

Track changes can be set on text elements. There are 2 ways to set the change information on an element.
Either by calling the `setChangeInfo()`, or by setting the `TrackChange` instance on the element with `setTrackChange()`.

.. code-block:: php

$phpWord = new \PhpOffice\PhpWord\PhpWord();

// New portrait section
$section = $phpWord->addSection();
$textRun = $section->addTextRun();

$text = $textRun->addText('Hello World! Time to ');

$text = $textRun->addText('wake ', array('bold' => true));
$text->setChangeInfo(TrackChange::INSERTED, 'Fred', time() - 1800);

$text = $textRun->addText('up');
$text->setTrackChange(new TrackChange(TrackChange::INSERTED, 'Fred'));

$text = $textRun->addText('go to sleep');
$text->setChangeInfo(TrackChange::DELETED, 'Barney', new \DateTime('@' . (time() - 3600)));
Loading