Forum


Replies: 2   Views: 4195
Replace variable by word fragment using math equation
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 fpa.777  · 22-08-2014 - 13:53

Hello, I'm trying to run the following code in Trial Version: $docx = new createDocxFromTemplate('template.docx'); $link = new WordFragment($docx); $link->addLink('link to Google', array('url'=> 'http://www.google.es', 'color' => '0000FF', 'u' => 'single')); $math = new WordFragment($docx); $math->addMathEquation( 'x=b±b24ac2a', 'mathml' ); $docx->replaceVariableByWordFragment( array('BLOCK_FIRST' => $link, 'BLOCK_LAST' => $math) ); $docx->createDocx('myexample'); The equation fragment isn't added to the document, but the link fragment worked fine. I don't know if I'm not using this method correctly, or it doesn't work for adding math equations. Can anyone help please?

Posted by fpa.777  · 22-08-2014 - 15:28

Also, it seems like using omml instead breaks the entire document. I'm using the code used as example at the addMathEquation documentation page. I'm starting to believe this approach doesn't work for equations, am I right? Thanks!

Posted by admin  · 25-08-2014 - 07:16

UPDATE: stable versions of phpdocx allow using addMathEquation with WordFragments.

Hello, The addMathEquation is not compatible with replaceVariableByWordFragment, but a next version of phpdocx will add support. Regards.