@@ -31,7 +31,7 @@ column shows the containers while the rows lists the elements.
3131+-------+-----------------+-----------+----------+----------+---------+------------+------------+
3232| 11 | Watermark | - | v | - | - | - | - |
3333+-------+-----------------+-----------+----------+----------+---------+------------+------------+
34- | 12 | Object | v | v | v | v | v | v |
34+ | 12 | OLEObject | v | v | v | v | v | v |
3535+-------+-----------------+-----------+----------+----------+---------+------------+------------+
3636| 13 | TOC | v | - | - | - | - | - |
3737+-------+-----------------+-----------+----------+----------+---------+------------+------------+
@@ -77,6 +77,13 @@ italics, etc) or other elements, e.g. images or links. The syntaxes are as follo
7777
7878For available styling options see :ref: `font-style ` and :ref: `paragraph-style `.
7979
80+ 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:
81+
82+ .. code-block :: php
83+
84+ $text = $section->addText('Hello World!');
85+ $text->setChanged(\PhpOffice\PhpWord\Element\ChangedElement::TYPE_INSERTED, 'Fred', (new \DateTime()));
86+
8087 Titles
8188~~~~~~
8289
@@ -276,11 +283,11 @@ Objects
276283-------
277284
278285You can add OLE embeddings, such as Excel spreadsheets or PowerPoint
279- presentations to the document by using ``addObject `` method.
286+ presentations to the document by using ``addOLEObject `` method.
280287
281288.. code-block :: php
282289
283- $section->addObject ($src, [$style]);
290+ $section->addOLEObject ($src, [$style]);
284291
285292 Table of contents
286293-----------------
@@ -309,7 +316,7 @@ Footnotes & endnotes
309316You can create footnotes with ``addFootnote `` and endnotes with
310317``addEndnote `` in texts or textruns, but it's recommended to use textrun
311318to have better layout. You can use ``addText ``, ``addLink ``,
312- ``addTextBreak ``, ``addImage ``, ``addObject `` on footnotes and endnotes.
319+ ``addTextBreak ``, ``addImage ``, ``addOLEObject `` on footnotes and endnotes.
313320
314321On textrun:
315322
@@ -465,4 +472,28 @@ The comment can contain formatted text. Once the comment has been added, it can
465472 // link the comment to the text you just created
466473 $text->setCommentStart($comment);
467474
468- 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.
475+ 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.
476+
477+ Track Changes
478+ -------------
479+
480+ Track changes can be set on text elements. There are 2 ways to set the change information on an element.
481+ Either by calling the `setChangeInfo() `, or by setting the `TrackChange ` instance on the element with `setTrackChange() `.
482+
483+ .. code-block :: php
484+ $phpWord = new \PhpOffice\PhpWord\PhpWord();
485+
486+ // New portrait section
487+ $section = $phpWord->addSection();
488+ $textRun = $section->addTextRun();
489+
490+ $text = $textRun->addText('Hello World! Time to ');
491+
492+ $text = $textRun->addText('wake ', array('bold' => true));
493+ $text->setChangeInfo(TrackChange::INSERTED, 'Fred', time() - 1800);
494+
495+ $text = $textRun->addText('up');
496+ $text->setTrackChange(new TrackChange(TrackChange::INSERTED, 'Fred'));
497+
498+ $text = $textRun->addText('go to sleep');
499+ $text->setChangeInfo(TrackChange::DELETED, 'Barney', new \DateTime('@' . (time() - 3600)));
0 commit comments