List formatting anomalies

I’m creating documents using a template that implements lists through the use of list styles.

If I create a list by applying the list style, intersperse some text, then create another list, all seems well. However, when editing the document, the list formatting is not properly applied (ex. adding a list item in the middle of the list and hitting [TAB] doesn’t give me the next list level down).

If I call ParagraphFormatting.ClearFormatting() while creating the lists, formatting such as list levels then work correctly but list numbering continues across the lists rather than restarting.

I’ve included a code snippet and the Word template in the attachment.

Thanks,
Joe

Just to clear up a minor point, I first run the code passing true to both calls to CreateList(), then compare it to the doc created when I pass false to both calls.

Hi,

Thank you for considering Aspose.

List styles are poorly documented thing for us. We have several logged defects that related to similar anomalies. I know that you reported similar issue some time ago (“incorrect action when pressing Enter and then Tab during editing a list built by Aspose.Word”), but I will log this one too. I hope we will improve list formatting as soon as possible.

You’re right, this is a continuation of the previous post so I should have clarified that. This post was more FYI than bug report.

I’ve done some more research and, as it turns out, this behavior is by design in Word. Every list item in a document that is defined by using the same style is considered part of the one list. Numbering must be restarted explicitly. It simply took calling ClearFormatting() for the list styles to be properly applied.