有没有办法从 IOFactory 获取部分?

Is there a way to get sections from an IOFactory?

我正在使用 PHPWord 来使用模板,但是当我以 HTML 格式保存文件时,我只能看到它的正文,而看不到页眉或页脚。所以我想让这些部分将它们插入 HTML 部分

  $Content = IOFactory::load($saveDocPath); 
  $Writer = IOFactory::createWriter($Content,'HTML');       
  $Writer->save($savePath); 

如果我使用 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 [▶]

你不能。一位贡献者的引述:

Header & Footer are only applicable when printing pages, which is not the case for HTML.

https://github.com/PHPOffice/PHPWord/issues/1105#issuecomment-317132143