Forum


Replies: 2   Views: 1250
Is it possible to change entire color occurances from a template document?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 04-08-2021 - 14:23

Hello,

There's no method to change all occurrences of a specific color in all targets: background, custom styles, default styles, contents... You need to use a set of methods: setBackgroundColor, setDocumentDefaultStyles, customizeWordContent.

If the color value to be changed is very specific and you are sure it won't appear in contents you don't want to replace, you can use rawSearchAndReplace that allows replacing specific text strings in all XML files of a DOCX.

Regards.