Forum


Replies: 3   Views: 2307
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 ISSL-blocked  · 25-06-2019 - 09:56

Hi there,

Our templates are user-generated, so contain many different styles. I understand that when using

$docx->replaceVariableByText('FULL_DESCRIPTION', 'My description');

that the original text properties are honoured - so it will retain bold, the font, etc. That's perfect.

However, when replacing with HTML or a WordFragment, this isn't the case and obviously these are more complicated.

I wondered if it was possible to get the text properties from a variable that's about to be replaced - something like using $docx->getDocxPathQueryInfo so that I could search for a variable like $FULL_DESCRIPTION$ and then be able to get its size, font, bold, etc properties so that I can reapply them myself to my HTML or to the WordFragment I'm creating?