Avoid having a blank line if a merge field is null

Hi,
Using Aspose.Word Mail Merge, I am trying to fill dynamic data from a database table to a Word template with the following merge fields:

«CustomerLastName», «CustomerFirstName» «CustomerMI» 
«CustomerAddress1» 
«CustomerAddress2»
«CustomerCity» «CustomerState» «CustomerPostalCode»
«CustomerPhone»

How can I avoid a blank line if CustomerAddress2 field is null?
Please advise.

Hi
Thanks for your inquiry. I think that you should use RemoveEmptyParagraphs property. See the following link for more information.
https://reference.aspose.com/words/net/aspose.words.mailmerging/mailmergecleanupoptions/
Also see the following code example and attached documents.

// Prepare datasource
DataTable table = new DataTable();
table.Columns.Add("CustomerLastName");
table.Columns.Add("CustomerFirstName");
table.Columns.Add("CustomerMI");
table.Columns.Add("CustomerAddress1");
table.Columns.Add("CustomerAddress2");
table.Columns.Add("CustomerCity");
table.Columns.Add("CustomerState");
table.Columns.Add("CustomerPostalCode");
table.Columns.Add("CustomerPhone");
// Add data
table.Rows.Add(new object[] { "Noskov", "Alexey", "Mr", "My address", null, "Auckland", "NZ", "61202", "98479349863"});
// Open template
Document doc = new Document(@"Test050\in.doc");
// Specifies whether paragraphs that contained mail merge 
// fields with no data should be removed from the document. 
doc.MailMerge.RemoveEmptyParagraphs = true;
// Execute mail merge
doc.MailMerge.Execute(table);
// Save document
doc.Save(@"Test050\out.doc");

Hope this helps.
Best regards.