PHPWORD行编号

时间:2014-03-03 11:29:49

标签: php phpword

如何在我的文档中添加行号?

我添加了这个;

$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');

我哪里错了?

2 个答案:

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