Aspose Words Item Numbering Error After Mail Merging

Simple .Net C# example provided as zip. The nested item numbering repeats 1. twice. It happens a lot when we tried to upgrade last month in many of our docs. Had to roll back to the 2016-2017 licensed version we were using. Please test this simple code and advise on when an update is released. Thanks!

AsposeWordsSupport.zip (9.8 MB)

@NWALAB,

We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-17660. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

Please also provide a little more information about the old Aspose.Words’ version number for which there were no problems on your side previously.

We were using aspose total 2016, the words dll version is 2016.08.31

@NWALAB,

Regarding WORDSNET-17660 , we have completed the work on your issue and concluded to close this issue as ‘Not a Bug’. Please see the following analysis details:

MS Word and Aspose.Words apply restartNumberingAfterBreak attribute for each list in document during mail merge.

You can use the List.IsRestartAtEachSection property to reset the restartNumberingAfterBreak attribute after mailmerge:

foreach (List list in doc.Lists)
	list.IsRestartAtEachSection = false;

Hope, this helps.

That fixes this test case, but I have lots of code to update with that approach. I don’t see any section breaks so why does this fix the issue? I’d have to retest the other documents in case they do want to restart on a section and I won’t know since I can’t code for each template in production. We’ve been using these documents for years without issue until now.

@NWALAB,

We are looking into this issue further and will get back to you with more details soon.

@NWALAB,

Regarding WORDSNET-17660, the list numbering restart attribute was added in WORDSNET-15054 and was mentioned in Aspose.Words for .NET 17.9 Release Notes ( see Added Public Property List.IsRestartAtEachSection section ). This section includes the generic workaround for backward compatibility during mail merge. The following is a more generic solution and hopefully, it will satisfy your needs:

Dictionary<List, bool> lists = new Dictionary<List, bool>();
 
foreach (List list in document.Lists)
    lists[list] = list.IsRestartAtEachSection;
 
document.MailMerge.Execute(...);
 
foreach (KeyValuePair<List, bool> pair in lists)
    pair.Key.IsRestartAtEachSection = pair.Value

No. there is no need to code for each template. The code above remembers the value for the restart numbering attribute for each list and restores it after the merge. It is a generic solution.

This is a strange behavior of MS Word. For some reason the attribute that is expected to affect numbering in different sections still affects it within one section during mail merge. This behavior of MS Word is not clear. But, the fact is that the attribute still does affect the numbering regardless of section breaks.

P.S. Please also note that we are in a constant process of getting closer and closer to MS Word - the product whose behavior we try to mimic. That is why from time to time we have to change the behavior. Sometimes the changes are breaking, but we cannot introduce a new API property to support each change. However, we do mention these changes in release notes section. Thank you for your understanding.

Thanks, I’ll use the dictionary cache approach, that’ll work.

A post was split to a new topic: Numbering issues aster upgrading from 11.8 to 23.1

A post was split to a new topic: Padding got removed after migrating from Aspose.Words 11.8 to 23.1

A post was split to a new topic: Font size is getting changed in merge fields values on Aspose.words version 13.10 and above

A post was split to a new topic: Empty bullet points are not getting removed from document after upgrading to Aspose.words 23.1

A post was split to a new topic: Texts in a paragraph moves down to next line after upgrading Aspose Words 11.8 to 23.1

A post was split to a new topic: Issue with Image in the merge field- Aspose Words 23.1