Hi,
I have a problem with replaceVariableByWordFragment (type: inline), when i replace the variables in my template document the text font size of the rest of the text is no longer the same.
Inside my template document will have something like this:
line text 1
line text 2 |mathml| and a text after.
line text 3
then i create a WordFragment and create a mathml throught addMathEquation().
when i run the replaceVariableByWordFragment and then create the file,
the text, line text 2 "replaced by mathml equation" and a text after, the "and a text after" portion is no longer the same font size with "line text 2" portion
my code is like this
$pStylev2 = array(
'font' => 'Times New Roman',
'fontSize' => 15,
'contextualSpacing' => true,
'spacingBottom' => 0,
'spacingTop' => 0,
'lineSpacing' => 240,
);
$docx = new CreateDocx();
$docx->addText("line text 1", $pStylev2);
$docx->addText("line text 2 |mathml| and a text after.", $pStylev2);
$docx->addText("line text 3", $pStylev2);
$tmpfilename = "sampledoc";
$docx->createDocx($tmpfilename);
$docxtemplate = new CreateDocxFromTemplate($tmpfilename. ".docx");
$docxtemplate->setTemplateSymbol('|');
$keyfragmentarray = array();
$mathml[] = '<math display="block" xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>';
foreach ($mathml as $key => $value) {
$fragment = new WordFragment($docxtemplate);
$fragment->addMathEquation($value, 'mathml', array('align' => 'left'));
$keyfragmentarray["mathml"] = $fragment;
}
$docxtemplate->replaceVariableByWordFragment($keyfragmentarray, array('type' => 'inline'));
$docxtemplate->createDocxAndDownload("replacesample.docx");
basically, "line text 2" will be font size 15 but the text after the mathml, "and a text after", will be turned into font size 11 (i think it is the default);
any help will be greatly appreciated. thanks