Forum


Replies: 4   Views: 353
Formula inside table
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 admin  · 20-02-2025 - 07:03

Hello,

Please note that the trial package doesn't include technical support. Please purchase a license to get technical support, remove trial watermarks, use phpdocx on a production server, and get all available features (https://www.phpdocx.com/features).

Using the current stable version of phpdocx, to add math equations as block WordFragments, you need to add them in a paragraph. For example:

$docx = new CreateDocx();

$math = new WordFragment($docx);
$math->addMathEquation(
    '<m:oMathPara>
        <m:oMath><m:r><m:t>∪±∞=~×</m:t></m:r></m:oMath>
    </m:oMathPara>', 'omml'
);
$textMath = new WordFragment($docx);
$textMath->addText([$math]);

$valuesTable = array(
    array(
        $textMath,
    )
);
$docx->addTable($valuesTable);

$docx->createDocx('output');

The next stable release of phpdocx won't have this requirement and adding math equations as block WordFragments will be possible without using an extra paragraph WordFragment.

Regards.