Forum


Replies: 8   Views: 4825
Add table by wordfragment not working
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 243127387@qq.com  · 13-10-2015 - 12:50

Hi ,

I may well be having a brain block moment. I change and run /examples/Core/addMathEquation/sample_2.php by adding a table. In the generated word, the table will not display properly. But I really need to do like this in the project of our company. We have purchased the version phpdocx-pro-5.0. We run the code is as follows:

$docx->addText('We write a math equation using OMML (the native Word XML standard for math equations):');

$docx->addMathEquation(
    '<m:oMathPara>
        <m:oMath><m:r><m:t>∪±∞=~×</m:t></m:r></m:oMath>
    </m:oMathPara>', 'omml'
);

$text = array();
$text[] = array('text' => 'The same equation inline: ');
$math = new WordFragment($docx);
$math->addMathEquation(
    '<m:oMathPara>
        <m:oMath><m:r><m:t>∪±∞=~×</m:t></m:r></m:oMath>
    </m:oMathPara>', 'omml'
);
$text[] = $math;

$table = new WordFragment($docx);
$tabeleArray=array(
     array('11','12','13'),
     array('21','22','23')
        );
$table->addTable($tabeleArray);
$text[] = $table;

$docx->addText($text);

   Am I missing something? Looking forward to your reply, thank you!