Question

how do I add line numbering to my document?

I added this;

$objWriter->startElement('w:lnNumTyp');
$objWriter->writeAttribute('w:start', '5');
$objWriter->writeAttribute('w:restart', '1');
$objWriter->endElement();

To my PhpWord\Writer\Word2007\Document.php script, immediately after;

$objWriter->startElement('w:sectPr');

Where am I going wrong?

Was it helpful?

Solution

Correct code is as follows;

$objWriter->startElement('w:lnNumType');
$objWriter->writeAttribute('w:countBy', '5');
$objWriter->writeAttribute('w:restart', 'continuous');
$objWriter->endElement();

It still goes after;

$objWriter->startElement('w:sectPr');

OTHER TIPS

Use the lineNumbering property of Section style that were available since 0.10.0.

Example: section = $phpWord->addSection(array('lineNumbering' => array()));

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top