Pregunta

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?

¿Fue útil?

Solución

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

Otros consejos

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

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top