PHPWord - multiple lists on a page, restarting numbering?

Soldato
Joined
26 Aug 2006
Posts
9,726
Location
62.156684,-49.781113
I realise this might be a long shot, but has anyone used PHPWord (https://phpword.codeplex.com/) or might otherwise be some kind of wizard and point me in the right direction on this...?

I'm creating a document that will contain multiple numbered lists on a page and have created two list definitions as this:

Code:
  ${'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:

Code:
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?

It seems as though not even adding a section restarts the numbering?!

Actually - someone else has reported it and nothing was forthcoming: https://phpword.codeplex.com/discussions/267216 - surely people have the need for multiple lists in their documents!
 
Associate
Joined
24 Jul 2013
Posts
17
Location
Gloucestershire
Hey!

I had to create .docx files for a company I worked for a while ago. We initially started using PHPWord, but found it to be quite limiting especially when working with templates. So we ended up purchasing a Pro license for PHPDocX for about $100 I think. PHPDocX has a free version, and provides you with most tools to create documents from scratch.

http://www.phpdocx.com/
 
Back
Top Bottom