RemoveEmptyParagraphs Sample


I’m trying to figure out the code for setting the RemoveEmptyParagraphs Property. Could someone please provide a sample code that sets this property to True. I would like to deletee empty mege fields from a document and have the other merge fileds move up. The sample in the documentation is not detailed enough for me. (Need visual aids).

Any help is appreciated



Just set it to true and execute mail merge.


/// This feature was requested by a customer.



public void TestRemoveEmptyParagraphsYes()


doc.MailMerge.RemoveEmptyParagraphs = true;


TestUtil.Save(doc, @“MailMerge\TestRemoveEmptyParagraphYes Out.doc”);

//Line 2 will be deleted

Assert.AreEqual(2, doc.Model.GetCountOf(typeof(MdlParagraph)));

Assert.AreEqual(“Value1\rValue31\x000c”, doc.Model.GetText());