问题描述
我正在使用 https://github.com/PHPOffice/PHPWord 来生成一个单词文档.函数addTOC生成带有标题的页面索引,但是由于某些原因,页面编号不显示.
I'm using https://github.com/PHPOffice/PHPWord to generate a word document.The function addTOC generates an index of pages with titles, but for some reason the page numbers do not display.
// add table of contents
$section->addTOC();
结果:
如果我在出现标题的页面上回显页码,它们将显示正常.但是它们不会显示在目录中.我检查确认文字不是白色.
If I echo the page numbers on the pages where the titles exist, they display fine. But they don't display in the TOC. I checked to confirm the text isn't white.
推荐答案
来自示例目录中的PHPWord示例( https://github.com/PHPOffice/PHPWord/blob/develop/samples/Sample_17_TitleTOC.php ),我会告诉您这是不可能的:
From PHPWord example in samples dir (https://github.com/PHPOffice/PHPWord/blob/develop/samples/Sample_17_TitleTOC.php), I would tell it is not possible:
我还试图在标题声明之后(当我们已经知道页码时)在文档末尾添加目录.但是没有成功.
I also tried to add the TOC at the end of the document, after titles declarations (when we already know page numbers). But with no success.
似乎是一个错误: https://github.com/PHPOffice/PHPWord/Issues/707
这篇关于PHPWord addTOC不显示页码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!