admin管理员组文章数量:1391999
In phpWord, I would like to modify the text that appears on the Table of Contents to be different from what appears in the individual section titles.
// Add title styles
$phpWord->addTitleStyle(1,[],[]);
// Add TOC
$toc = $section->addTOC();
//Section 0
$section = $phpWord->addSection();
$section->addTitle('Section 00', 1);
//Section 1
$section = $phpWord->addSection();
$section->addTitle('Section 01', 1);
//Section 2
$section = $phpWord->addSection();
$section->addTitle('Section 02', 1);
This will produce a Table of Contents that looks like this:
Section 00......................2
Section 01......................3
Section 02......................4
Is there a way to make the text on the Table of Contents display something different from the text that is printed in the actual sections?
What I want:
Section 00.............................2
Section 01 (Not Applicable)............3
Section 02 (Will be submitted Later)...4
I still want the sections of the document to have the titles Section 00, Section 01, Section 02; but I want to be able to modify the text that appears in the TOC.
Is that possible?
What I'm hoping is that something like the line below exists, but I can't find anything like that in the documentation.
$section->addTitle('Section 01', 1,['altext' => 'Section 01 (Not Applicable)']);
本文标签: phpWord make Table of Contents text different from section titles textStack Overflow
版权声明:本文标题:phpWord make Table of Contents text different from section titles text? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744601284a2615082.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论