Reputation: 121
I'm creating a document that will contain multiple numbered lists on a page and have created two list definitions as this:
${'references_' . $testcase} = array('listType'=>PHPWord_Style_ListItem::TYPE_NUMBER_NESTED);
${'procedure_' . $testcase} = array('listType'=>PHPWord_Style_ListItem::TYPE_NUMBER_NESTED);
They're then being called within loops to add to the lists:
for ($i = 1; $i <= 10; $i++) {
$body->addListItem('List Item ' . $i, 0, null, ${'references_' . $testcase});
}
for ($j = 1; $j <= 10; $j++) {
$body->addListItem('List Item ' . $j, 0, null, ${'procedure_' . $testcase});
}
However, the second list numbering starts at 11 - how can I have this set back to 1?
Upvotes: 0
Views: 2629
Reputation: 161
it's an old thread and all but afaik you need to put your lists in seperate textruns to have the numbering start again
Upvotes: 1
Reputation: 106
I was trying to solve this myself today and I found a fork of PHPWord called PHPWord2. At the moment the code for numbering restart is only in a work branch. Read more at https://github.com/PHPOffice/PHPWord/issues/10. Examples are included in the work branch.
Upvotes: 0