如何在我的文档中添加行号?
我添加了这个;
$objWriter->startElement('w:lnNumTyp');
$objWriter->writeAttribute('w:start', '5');
$objWriter->writeAttribute('w:restart', '1');
$objWriter->endElement();
紧接着我的PhpWord\Writer\Word2007\Document.php
脚本;
$objWriter->startElement('w:sectPr');
我哪里错了?
答案 0 :(得分:2)
正确的代码如下;
$objWriter->startElement('w:lnNumType');
$objWriter->writeAttribute('w:countBy', '5');
$objWriter->writeAttribute('w:restart', 'continuous');
$objWriter->endElement();
它仍在继续;
$objWriter->startElement('w:sectPr');
答案 1 :(得分:1)
使用自0.10.0以来可用的lineNumbering
样式的Section
属性。
示例:section = $phpWord->addSection(array('lineNumbering' => array()));