Free Support Forum -

MailMerge: Suppress blank lines in merged document


My scenario is similar to Mail Merge not supressing blank lines. However, solution specified in the link does not work for me.

Below is my sample code
// Creating datasource
var dt = new DataTable(“Table1”);
dt.Columns.Add(“LEGAL_NAME”, typeof(string));
dt.Columns.Add(“PO_BOX”, typeof(string));
dt.Columns.Add(“PO_LOCALITY”, typeof(string));
dt.Columns.Add(“PO_POSTCODE”, typeof(string));
dt.Columns.Add(“M_BUILDING”, typeof(string));
dt.Columns.Add(“M_SHOP_NO”, typeof(string));
dt.Columns.Add(“M_STREET_NO”, typeof(string));
dt.Columns.Add(“M_STREET”, typeof(string));
dt.Columns.Add(“M_LOCALITY”, typeof(string));
dt.Columns.Add(“M_STATE”, typeof(string));
dt.Columns.Add(“M_POSTCODE”, typeof(string));
dt.Rows.Add(“SAM SAMPLE”, null, null, null, “23”, “Bldg1”, “23”, “Elizabeth”, “Sydney”, “NSW”, “2000”);
dt.Rows.Add(“SAM SAMPLE”, “PO BOX 1243”, “MINTO”, “2533”, null, null, null, null, null, null, null);
// Merging doc
doc.MailMerge.RemoveEmptyParagraphs = true;
doc.MailMerge.RemoveEmptyRegions = true;
doc.MailMergeSettings.DoNotSupressBlankLines = false;
doc.Save(outputStream, SaveFormat.Pdf);

I am using Aspose.Words assembly with version 2011.09.30 in .net 4.5 (29.9 KB)



Thanks for your inquiry. After an initial test with Aspose.Words for .NET 18.4, we were unable to reproduce this issue on our end (please see 18.4.pdf (19.6 KB)). We would suggest you please upgrade to the latest version of Aspose.Words for .NET. You can download it from the following link.