I'm using PHPWord to use a template but when I save my file in HTML format I only see its body and not the header or footer. So I would like to get these sections to insert them in the HTML part
$Content = IOFactory::load($saveDocPath);
$Writer = IOFactory::createWriter($Content,'HTML');
$Writer->save($savePath);
if I use dd() I can see the header and footer of the docx file
#phpWord: PhpOffice\PhpWord\PhpWord {#1299 ▼
-sections: array:1 [▼
0 => PhpOffice\PhpWord\Element\Section {#1493 ▼
#container: "Section"
-style: PhpOffice\PhpWord\Style\Section {#1494 ▶}
-headers: array:1 [▶]
-footers: array:1 [▶]
-footnoteProperties: null
#elements: array:25 [▶]
CodePudding user response:
You can't. A quote from one of the contributors:
Header & Footer are only applicable when printing pages, which is not the case for HTML.
https://github.com/PHPOffice/PHPWord/issues/1105#issuecomment-317132143