Forum


Replies: 3   Views: 2179
Get text properties from a variable
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  · 25-06-2019 - 11:35

Hello,

UPDATE: the latest release of phpdocx includes options to apply (and mix if needed) placeholder styles to new HTML and WordFragment contents using template methods.

Both replaceVariableByHTML and replaceVariableByWordFragment methods include the type option, that can be inline or block. If you use a block replacement (the default in both methods), then the container paragraph is removed so some styles can disappear (such as the preset paragraph styles). If the type option is set to inline the paragraph styles aren't removed but only inline contents are added.

There's no method to do a block replacement and apply automatically the previous paragraph styles, so the new styles must come from the HTML/WordFragment. Using getWordStyles you can get the styles from a DOCXPath query, but (as you say) you'd need to iterate the array output of the previous method to generate the HTML or WordFragment with the styles.

Regards.