@@ -31,7 +31,7 @@ column shows the containers while the rows lists the elements.
31
31
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
32
32
| 11 | Watermark | - | v | - | - | - | - |
33
33
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
34
- | 12 | Object | v | v | v | v | v | v |
34
+ | 12 | OLEObject | v | v | v | v | v | v |
35
35
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
36
36
| 13 | TOC | v | - | - | - | - | - |
37
37
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
@@ -77,6 +77,13 @@ italics, etc) or other elements, e.g. images or links. The syntaxes are as follo
77
77
78
78
For available styling options see :ref: `font-style ` and :ref: `paragraph-style `.
79
79
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
+
80
87
Titles
81
88
~~~~~~
82
89
@@ -276,11 +283,11 @@ Objects
276
283
-------
277
284
278
285
You 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.
280
287
281
288
.. code-block :: php
282
289
283
- $section->addObject ($src, [$style]);
290
+ $section->addOLEObject ($src, [$style]);
284
291
285
292
Table of contents
286
293
-----------------
@@ -309,7 +316,7 @@ Footnotes & endnotes
309
316
You can create footnotes with ``addFootnote `` and endnotes with
310
317
``addEndnote `` in texts or textruns, but it's recommended to use textrun
311
318
to have better layout. You can use ``addText ``, ``addLink ``,
312
- ``addTextBreak ``, ``addImage ``, ``addObject `` on footnotes and endnotes.
319
+ ``addTextBreak ``, ``addImage ``, ``addOLEObject `` on footnotes and endnotes.
313
320
314
321
On textrun:
315
322
@@ -465,4 +472,28 @@ The comment can contain formatted text. Once the comment has been added, it can
465
472
// link the comment to the text you just created
466
473
$text->setCommentStart($comment);
467
474
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