Nested or the multi-level numbered lists allow you to group the items based on the parent item. Put it simply, you can separately list the items under each group. This becomes very useful when you have to list the items having multiple sub-items. Let’s have a look at the following figure which makes it simpler to understand the scenario.
In this figure, you can observe that there are listed 3 groups and each group further has multiple items listed under it. So, in such cases nested numbered list is used.
Lets now check out how could you populate a numbered list within your Word documents using GroupDocs.Assembly. Assume that you have the Order and Service classes defined in your application in such a way that each order instance has multiple services. The following template will be used to output the orders along with the services they have using the API:
The Word document that will be generated in the result of the above template will contain the following listing:
The perfect output, isn’t it? No, not at all. You would have noticed that the numbering of the list is disturbed. Yes, the numbering sequence is continued and it hasn’t restarted for the second list. Well, this is the expected behavior when you generate the numbered list using this template.
So how would you deal with such a situation when you want to restart the list’s numbering? Well, believe me, it is as simple as a pie. Just place a restartNum tag before the inner foreach and you are done.
This is how the updated version of the template will look like. We have now placed restartNum tag to restart the list numbering for each order.
And what we have got in the output is:
At the moment, you can restart the list numbering within the Word Processing documents as well as email messages with HTML and RTF bodies.
So if you want to have this feature in your application, just download and integrate v19.7 of GroupDocs.Assembly for .NET or Java. For working code samples, download or clone the examples project from the GitHub repository. Cheers!