5

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();

Results in:

Table of contents

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.

4

1 回答 1

0

从示例目录中的 PHPWord 示例(https://github.com/PHPOffice/PHPWord/blob/develop/samples/Sample_17_TitleTOC.php),我会告诉它是不可能的:

echo date('H:i:s'), '注意:请手动刷新目录。', EOL;

我还尝试在标题声明之后(当我们已经知道页码时)在文档末尾添加 TOC。但没有成功。

编辑:似乎是一个错误:https ://github.com/PHPOffice/PHPWord/issues/707

于 2016-08-17T11:36:33.493 回答