Description
Describe the bug and add attachments
When we use cloneBlock in the template and assign values, the content of the document is formatted by default with different styles than when we save the block in the template.
For example, if in my template I have the following formatted in bold, font 12, colors or underlined and more with:
${block}
${title}
${content}
${/block}
When we execute $this->template->cloneBlock('block', 0, true, false, $replacements);
the font style and font size change by default (Calibri, and font size 10).
The strange thing is that the styles are maintained for the line breaks under ${title} or ${content}
Template definition (Museo Sans, Bold, Justify, Font Size 11):
Output (Removes bold; Change font size to 10):
and when the file is processed and you manually write below the elements (it retains some styles from the template):
PD: I am using the HTMLtoOpenXML\Parser to assign html data into the block variables (https://github.com/ffmad/HTMLtoOpenXML) with something like:
public function parse($content){
$parser = new \HTMLtoOpenXML\Parser();
return $parser->fromHTML($content);
}
$replacements[] = [
'title' => $this->parse($htmlContent),
'content' => $this->parse($htmlContent)
];
Expected behavior
Output content within block variables formatted as the template was configured
Steps to reproduce
-
Initialize template processor
-
Process html content with HTMLtoOpenXML
-
Clone block and assign variables with :
$this->template->cloneBlock('block', 0, true, false, $replacements);
PHPWord version(s) where the bug happened
1.2
PHP version(s) where the bug happened
7.4