Forum


Replies: 3   Views: 3937
Addmathequation() problem when inserting into list?
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 jiri111  · 27-02-2015 - 17:07

Hi anyone who can help ;-) This SW is very nice, we were considering to buy it but for some reason the crucial feature for us doesn't work :-( Is anyone able to tell me why or what am I missing? Here is what I need to achieve: - put a math equation in a list in order to: a) style it because list can be styled, centered, etc. b) use it in ordered list Simple comparison: - Method addText can be styled too, but this doesn't accept math equations of course. - addMathEquation() works well when only when not used with Word fragment in a list I created following test case, is anyone able to help me? Configuration returned by check.php is as follows: PHP version is 5.4.24 Zip support is enabled. DOM support is enabled. XML support is enabled. Tidy support is enabled. Tried on both Windows and Linux system -> still same result. Test case: --- <?php /* Put your path to phpdocx here */ require_once ('inc/phpdocx/classes/CreateDocx.inc'); $equation = '<math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><msup><mi>x</mi><mn>3</mn></msup><msup><mi>z</mi><mn>4</mn></msup></mfrac></math>'; $docx = new CreateDocx(); $listOptions = array(); $listOptions[0]['type'] = 'upperLetter'; $listOptions[0]['format'] = '%1.'; $listOptions[0]['font'] = 'Arial'; $docx->createListStyle('ftoptions', $listOptions); $options = array('font' => 'Arial','fontSize' => 14); /* Uncomment following code to see: 1) It doesn't work - equation is not displayed 2) Word says file is broken upon opening $htmlData = new WordFragment ($docx); $htmlData->embedHTML ("Some text"); $htmlData->addMathEquation ($equation); $items[] = $htmlData; $docx->addList ($items,'ftoptions',$options); */ /* Following code works, but: - cannot be styled or put into list (equation is always in center, not using bullet list, etc. - equation is not on the same line as text * Comment this out when you uncomment previous code */ $docx->embedHTML ("Some text"); $docx->addMathEquation ($equation,'mathml'); $docx->createDocxAndDownload ('/tmp/file_test'); ?> --- Cheers for any hint, Jiri