Closed Deathef closed 4 years ago
@Deathef Could you please attach the source template, the output document and the desired output? We will check the issue and provide you more information.
@AlexNosk annex is the source template, the output document and the desired output demo.zip
@Deathef Thank you for additional information. I managed to reproduce the problem on my side and logged the issue as WORDSNET-20778 in our bug traching system We will let you know once the issue is resolved.
@Deathef MS Word applies restartNumberingAfterBreak attribute to each list in document during mail merge. Aspose.Words also follows this behavior. So this is considered as Not a bug. You may use the following code snippet to retain original list numbering:
Document doc = new Document(resourceWordPath);
Map<List,Boolean> lists = new HashMap<List,Boolean> ();
for (List list : doc.getLists())
lists.put(list,list.isRestartAtEachSection());
doc.getMailMerge().execute(new String[]{"name"}, new String[]{"111"});
for (Map.Entry<List, Boolean> pair : lists.entrySet())
pair.getKey().isRestartAtEachSection(pair.getValue());
doc.updateFields();
doc.save(targetWordPath);
Please let me know if the proposed workaround works for you and the issue can be closed.
@AlexNosk According to the code you provided, we successfully solved the problem;
I call the method getMailMerge().execute() after updateFields, then it comes a bug like this
![demo2](https://user-images.githubusercontent.com/32616338/86588704-cb140600-bfbe-11ea-94fc-c13bb7bababf.png)