PHPWord addTOC不显示页码 [英] PHPWord addTOC is not displaying page numbers

查看:517
本文介绍了PHPWord addTOC不显示页码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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示例(

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:

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

echo date('H:i:s'), ' Note: Please refresh TOC manually.', EOL;

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

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不显示页码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆