Forum


Replies: 2   Views: 696
Docx rtl generation from file template
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 s.montanarella  · 06-10-2022 - 13:20

Hi',

we have an issue trying to generate a RTL docx starting from a template injecting html with replaceVariableByHTML.
The LTR file is perfect.

With RTL (HTML "dir" attribute) the resulting docx file does not display correctly preset paragraph styles like "Normal", "Heading 1", etc...

Example: I've set "Heading 1" as "family: Calibri, size: 15". When I open the resulting doc font is changed in Arial 26; same thing for all other styles.

Is it possibile to use the same template for LTR and RTL documents?
We have already tried to set Bidi and Rtl parameters but, in this case, we have an error:
Fatal error: Uncaught Error: Call to a member function createElement() on null in /usr/src/docxConverter/libraries/phpdocx-premium-11.0/classes/CreateDocx.php:8790`

Thank you in advance,
Federico Filippi

Posted by admin  · 06-10-2022 - 13:55

Hello,

The setRTL method doesn't transform a LTR template into a RTL template. This method does the following:

Sets global right to left options

RTL options are enabled in the document and also new contents added apply RTL settings, but existing contents and styles are not transformed to RTL. If you want to change existing styles, for example to set RTL and bidi to existing template styles, you'd need to use DOCXCustomizer.

We recommend you generate a new RTL template from your LTR template.

The error you get may appear if some footnote or endnote content in the document doesn't include style tags to apply RTL.

Regards.

Posted by s.montanarella  · 07-10-2022 - 09:11

Ok, thank you!