RTF Writer: PreserveText - Create
Description
Create PreserveText
Checklist:
- [x] My CI is :green_circle:
- [x] I have covered by unit tests my new code (check build/coverage for coverage report)
- [x] I have updated the documentation to describe the changes
- [x] I have updated the changelog
coverage: 96.622% (-0.1%) from 96.757% when pulling c58ea5e2bb65895a23fdbffbc775670576680d00 on rasamassen:preserveText into 0ab0b4940bc52c7183e82ab2fd55324607037a73 on PHPOffice:master.
The description of preserveText in (Samples)[https://github.com/PHPOffice/PHPWord/blob/master/docs/usage/elements/preservetext.md] suggests that preserveText can be used to add Fields. This feels odd since there is already a field element? My current commit adds fields as described.
But what is the point of preserveText? preserveText sounds like it's supposed to be used for adding things like whitespace and special characters (like braces and slashes), but text already does that just fine. Instead of "preserving" the text, it currently adds fields.
So though I've built this like described, I'm confused what the purpose of the element is?
You are correct that PreserveText isn't absolutely required, but it can make things a lot simpler.
$footer->addPreserveText('Page {PAGE} of {NUMPAGES}');
is much easier than adding a TextRun consisting of Text/Field/Text/Field.