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

Free Support Forum - aspose.com

Merging with the empty table

Hi,

I have googled around and discovered the following thread : http://www.aspose.com/community/forums/2/267850/problem-merging-with-empty-table/showthread.aspx

I am using Aspose.Words.dll version 11.10. I noticed that when we are performing merging with an empty dataset, the result will display the merge table structure in the words which are not good.

May i know whether there is an option not to display the table when it's merged with the empty dataset ?

This issue is not happened using Aspose.Words version 5.1

Regards,

hadi teo

Hi,

I have attached 2 samples.

1) Aspose11EmptyDataTable.zip -> in this attachment, you can see that the file "out.doc" is still displaying the structure of the table even though the data is empty.

2) Aspose5EmptyDataTable.zip -> in this attachment, you can see that the file "out.doc" has empty pages.

Regards,

hadi teo

Hi Hadi,


Thanks for your inquiry. Please use the MailMerge.CleanupOptions property to remove unused merge fields during mail merge as shown in following code snippet. The MailMergeCleanupOptions enumeration specifies options that determine what items are removed during mail merge.

I suggest you to read following documentation link for your kind reference.
http://www.aspose.com/docs/display/wordsnet/How+to++Remove+Unmerged+Fields+and+Empty+Paragraphs+during+Mail+Merge
http://www.aspose.com/docs/display/wordsnet/How+to++Migrate+to+Aspose.Words+9.2+or+Higher


<span style=“font-size:10.0pt;
font-family:“Courier New”;color:green;mso-font-kerning:0pt;mso-ansi-language:
PL;mso-no-proof:yes”>// Use DataTable as a data source.<o:p></o:p>

DataTable resultsTable = GetEmptyDataTable();

Document doc = new Document(MyDir + "in.doc");

doc.MailMerge.CleanupOptions |= Aspose.Words.Reporting.MailMergeCleanupOptions.RemoveEmptyParagraphs;

doc.MailMerge.CleanupOptions |= Aspose.Words.Reporting.MailMergeCleanupOptions.RemoveUnusedRegions;

doc.MailMerge.CleanupOptions |= Aspose.Words.Reporting.MailMergeCleanupOptions.RemoveUnusedFields;

doc.MailMerge.CleanupOptions |= Aspose.Words.Reporting.MailMergeCleanupOptions.RemoveContainingFields;

doc.MailMerge.ExecuteWithRegions(resultsTable);

doc.Save(MyDir + "out.doc");


Hi Tahir,

Thanks for your assistance. Your suggestion is very helpful. My issue has been resolved.

Regards,

hadi teo

Hi Hadi,


Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.