We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Continued numbered list is resetted by MailMerge

Hi folks,
we found an issue within mailmerge: in the template a numbered list ist separated by two continuing section-changes. When this document is processed by mailmerge the continued part is resetted and starts again at 1.
Archiv.zip (12.9 KB)
I wrote a simple junit which produces the incorrect output file
Used Aspose version is: 19.11

@ns1045 You should specify MailMerge.RestartListsAtEachSection to get the desired result. For example see the following code:

Document doc = new Document("C:\\Temp\\in.docx");
doc.getMailMerge().setRestartListsAtEachSection(false);
doc.getMailMerge().execute(new String[]{"Field_1"}, new Object[]{"Value1"});
doc.save("C:\\Temp\\out.docx", SaveFormat.DOCX);

Hi Alexey,

thanks for the reply. As I know the restartList is a property on the single list-item so when I add code as you suggest no list can be restartet anymore?
In which Aspose.words for Java version was the method setRestartListsAtEachSection added? It is missing in 19.11.

Cheers,
ns1045

@ns1045 The property has been introduced in 21.5 version of Aspose.Words:
https://docs.aspose.com/words/java/aspose-words-for-java-21-5-release-notes/

When you restart numbering in MS Word, it simply creates a new list, so the property will not affect the restarted lists in your document.

Thanks a lot!
Cheers, ns1045

1 Like