[英]Is there a way to get sections from an IOFactory?
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.我正在使用 PHPWord 来使用模板,但是当我以 HTML 格式保存我的文件时,我只能看到它的正文而不是页眉或页脚。 So I would like to get these sections to insert them in the HTML part所以我想让这些部分将它们插入到 HTML 部分
$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如果我使用 dd() 我可以看到 docx 文件的页眉和页脚
#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 [▶]
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.页眉和页脚仅在打印页面时适用,HTML 则不然。
https://github.com/PHPOffice/PHPWord/issues/1105#issuecomment-317132143 https://github.com/PHPOffice/PHPWord/issues/1105#issuecomment-317132143
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.