You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using TemplateProcessor, setComplexBlock, trying to add a section. But no section existing in PhpOffice\PhpWord\Writer\Word2007\Element\ result in PHP error
public function setComplexBlock($search, Element\AbstractElement $complexType): void
{
$elementName = substr(get_class($complexType), strrpos(get_class($complexType), '\') + 1);
$objectClass = 'PhpOffice\PhpWord\Writer\Word2007\Element\' . $elementName;
$xmlWriter = new XMLWriter();
/** @var \PhpOffice\PhpWord\Writer\Word2007\Element\AbstractElement $elementWriter */
$elementWriter = new $objectClass($xmlWriter, $complexType, false);
$elementWriter->write();
$this->replaceXmlBlock($search, $xmlWriter->getData(), 'w:p');
}
Steps to Reproduce
$section = (new PhpWord())->addSection();
OR
$objectClass = 'PhpOffice\PhpWord\Element\' . 'Section';
$word_obj = new $objectClass();
THEN
$this->setComplexBlock($search, $section, 'Variable', 1, false);
with $search the block macro (and needs a template too)
Expected Behavior
Add the section in the tempDocumentMainPart
Current Behavior
PHP Error
Context
PHP Version: 7.4
PHPWord Version: 1.1.0
The text was updated successfully, but these errors were encountered:
Describe the Bug
Using TemplateProcessor, setComplexBlock, trying to add a section. But no section existing in PhpOffice\PhpWord\Writer\Word2007\Element\ result in PHP error
public function setComplexBlock($search, Element\AbstractElement $complexType): void
{
$elementName = substr(get_class($complexType), strrpos(get_class($complexType), '\') + 1);
$objectClass = 'PhpOffice\PhpWord\Writer\Word2007\Element\' . $elementName;
Steps to Reproduce
$section = (new PhpWord())->addSection();
OR
$objectClass = 'PhpOffice\PhpWord\Element\' . 'Section';
$word_obj = new $objectClass();
THEN
$this->setComplexBlock($search, $section, 'Variable', 1, false);
with $search the block macro (and needs a template too)
Expected Behavior
Add the section in the tempDocumentMainPart
Current Behavior
PHP Error
Context
The text was updated successfully, but these errors were encountered: