Hello supportteam,
how can I pass the pStyle Option from one WordFragment to another?
here is a simplified sample of my code:
$docx = new CreateDocxFromTemplate($this->templateName);
$wfMain = new WordFragment($docx);
$wfMain->addText('Title:', array('pStyle' => 'Heading1'));
$wfMain->addText('SubTitle:', array('pStyle' => 'Heading2'));
$wfMain->addText('SubSubTitle:', array('pStyle' => 'Heading3'));
$individualparts = array();
$text1 = new WordFragment($docx);
$text1->addText('Hello world 1', array('pStyle' => 'Heading3', 'caps' => 'true'));
$text2 = new WordFragment($docx);
$text2->addText('Hello world 2', array('pStyle' => 'Heading1'));
// ... and more individual parts like charts (all should be WordFragments with individual styles from the word-template)
$individualparts[4] = $text1;
$individualparts[2] = $text2;
ksort($individualparts, SORT_NUMERIC); // sorting the individual parts
$wfMain->addText('$individualparts'); // here I lost the pStyle from $text1 and $text2
// $wfMain->addText('$individualparts', array('pStyle' => 'Heading2')); // this works but unfortunately for all $individualparts
$docx->replacevariableByWordfragment(array('placeholder' => $wfMain), array('type' => 'block'));
$docx->createDocx('Bericht');
I lost pStyle from $text1 and $text2 bu interestingly the 'caps' - option works ... why not pStyle?
Any help for me please?
Best regards Siegfried