Maybe I've looked in all the wrong places, but I've been having a hard time finding instructions on how to restart a numbered list using OpenXML. I couldn't immediately find an explanation in the spec, nor could I find a handy example, so I have spent some time looking at the Word-generated OpenXml to perhaps obtain some clues and it's quite confusing. It appears that the order and organization of the abstract numbering items in the numbering part are relevant?
We managed to get it to work, but only by doing some really odd stuff, like making sure similar elements on the same level of the XML DOM like the abstract numbering elements and num elements were separated, and we messed with the order of the elements and even added a dummy list definition which seemed to help. But this does not seem like a wise way to carry on, so I'd love some more clarification on the topic! Thanks.
Edit: to clarify, I'm referring to restarting a list of the same level, without any different level list elements in between.
Hi,
Try giving different value for the val attrubute where you want to restart the numbering.
like <w:numId w:val="2" /> in document.xml and
<w:lvl w:ilvl="1">
<w:start w:val="1" /> in numbering.xml file
Details mentioned in the page no 787 in the OpenXML spec may be helpful to you.
Sheela
Thanks, but unfortunately, I've tried that, but it doesn't seem to do the trick. Even with an entirely new abstract numbering definition and new numId, the list will continue the numbering of the last as long as it's on the same level, in the code I've generate at least.
For example, I've tried this process:
This does not work for me.
I've tried examining a document that Word generates real closely, but I can't really derive any tips from it. Word itself does not seem to use a special tag that I might be overlooking. The primary differences between what it does and what I do is the ordering of the assignment of abstract id definitions with numbering instances and the differing nsId values. I've tried manipulating this, and have not been able to produce anything consistent.
I've tried adding a levelOverride to the numbering instances in the numbering part, as talked about on page 787 of the spec. This doesn't seem to restart the list, only change the style on that level (but keeps incrementing the numbering on that level).
Since Word iteself doesn't seem to be using any special tags that I'm using, I'm not so sure this is the solution.
I've managed to get what I want to work on a couple occasions by heavily manipulating the numbering part -- doing odd things like deleting a numbering definition in the numbering part of a list that's actually used in the document will sometimes trigger a numbering restart for that level.
Maybe there's another error in my numbering part that's creating a side effect that won't let me restart numbered lists?
Ok, I think I have found a solution. Placing a "startOverride" tag in the num elements of the numbering part will restart the lists. It's a little bit cumbersome because as far as I can tell, the level overrides don't inherit the attrivutes and elements of the original abstract definition, meaning I basically have to redefine the whole numbering definition in the num element. But I can live with that until I come across a more elegant solution.