Forum


Replies: 1   Views: 2442
Align mathml that were created through replacevariablebywordfragment.
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 droh10  · 14-06-2018 - 09:12

Hi All,

Anyone can help me with this alignment problem i have?

First of all, i have this document content that has a mathml, tables, svg images and other html tags. I parse and replace all mathmls with a variable so that i can change it later though WordFragment, then i also parsed all svg images replace it again with a variable and convert the images to jpeg.

Once all the mathml and svg images are replaced with variables, i embedHTML the content and create the document. The created document is used as a template, then i created a WordFragment to add all the mathml and converted images to the template through replaceVariableByWordFragment and then create the new document with all the correct mathml and images inside.

But when i open the newly created document, the alignment of the mathml is "Justified" and appears in the middle of the document when the mathml is alone in a line or if it is inside a table cell. When i created the mathml it was aligned left (addMathEquation($value, 'mathml', array('align' => 'left'))) but inside the document it is aligned "Justified". I noticed that when it is inside a table cell, even if i aligned the cell to the left, the mathml is not following.

Is there a way that we dont have to manually align them? I hope someone can help me on this.

Thanks in advance.

Posted by admin  · 14-06-2018 - 14:09

Hello,

Math equations have some limitations related to alignments. We recommend you to use DOCXCustomizer (https://www.phpdocx.com/documentation/introduction/docxcustomizer) to change alignments on the fly if needed, maybe you need to set both w:p/w:tc and math alignments.

If you open a support ticket (https://www.phpdocx.com/support) with your template and the smallest code inserting a math equation, the dev team will generate a custom script to illustrate how to accomplish it.

Regards.