Footers automatically linked to previous after updating fields

In our document we have new section that is started inside if statement. This section defines new heading & footer that should be aplied if this section is present. After Word Mail Merge this heading is applied properly. However if I perform merge using Aspose then header & footer is deleted - he is linked to previous section. Is this a bug or am I doing something wrong? I would expect consistent behaviour with Word.

I have attached input document and results that I get using different merges.

Code that I’m using for merging fields:

inputDocument.MailMerge.CleanupOptions =
    MailMergeCleanupOptions.RemoveEmptyParagraphs |
    MailMergeCleanupOptions.RemoveUnusedRegions |
    MailMergeCleanupOptions.RemoveUnusedFields |
    MailMergeCleanupOptions.RemoveContainingFields;

inputDocument.MailMerge.Execute(dataSource);
inputDocument.MailMerge.ExecuteWithRegions((IMailMergeDataSourceRoot)dataSource);

inputDocument.UpdateFields();

Hi Mariusz,

Thanks for your inquiry. We have tested the scenario using following code example and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-13580. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Document inputDocument = new Document(MyDir + "Template+Header+Footer+conditional.docx");
inputDocument.MailMerge.CleanupOptions =
MailMergeCleanupOptions.RemoveEmptyParagraphs |
MailMergeCleanupOptions.RemoveUnusedRegions |
MailMergeCleanupOptions.RemoveUnusedFields |
MailMergeCleanupOptions.RemoveContainingFields;
// Fill the fields in the document with user data.
inputDocument.MailMerge.Execute(
new string[] { "Certificate_Required", "Summary_Required" },
new object[] { "Yes", "Yes" });
inputDocument.UpdateFields();
inputDocument.Save(MyDir + "Out.docx");

The issues you have found earlier (filed as WORDSNET-13580) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.