Skip to content

Commit fbe52dc

Browse files
Progi1984laminga
andauthored
Documentation : Updated Comment element (#2650)
Fix error on comments code snippet. Co-authored-by: laminga <39699385+laminga@users.noreply.github.com>
1 parent 997a829 commit fbe52dc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

docs/changes/2.x/2.0.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- 32-bit Problem in PasswordEncoder [@oleibman](https://github.com/oleibman) fixing [#2550](https://github.com/PHPOffice/PHPWord/issues/2550) in [#2551](https://github.com/PHPOffice/PHPWord/pull/2551)
1919
- Typo : Fix hardcoded macro chars in TemplateProcessor method [@glafarge](https://github.com/glafarge) in [#2618](https://github.com/PHPOffice/PHPWord/pull/2618)
2020
- XML Reader : Prevent fatal errors when opening corrupt files or "doc" files [@mmcev106](https://github.com/mmcev106) in [#2626](https://github.com/PHPOffice/PHPWord/pull/2626)
21+
- Documentation : Updated Comment element by [@laminga](https://github.com/laminga) in [#2650](https://github.com/PHPOffice/PHPWord/pull/2650)
2122

2223
### Miscellaneous
2324

docs/usage/elements/comment.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Comment
22

33
Comments can be added to a document by using ``addComment``.
4-
The comment can contain formatted text. Once the comment has been added, it can be linked to any element with ``setCommentStart``.
4+
The comment can contain formatted text. Once the comment has been added, it can be linked to any element with ``setCommentRangeStart``.
55

66
``` php
77
<?php
@@ -17,7 +17,8 @@ $textrun = $section->addTextRun();
1717
$textrun->addText('This ');
1818
$text = $textrun->addText('is');
1919
// link the comment to the text you just created
20-
$text->setCommentStart($comment);
20+
$text->setCommentRangeStart($comment);
21+
$textrun->addText(' a test');
2122
```
2223

23-
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.
24+
If no end is set for a comment using the ``setCommentRangeEnd``, the comment will be ended automatically at the end of the element it is started on.

0 commit comments

Comments
 (0)