Free Support Forum -

Blank lines not being removed

I have many word documents that I am malmerging data into. Most of them start with a name followed by an address_line1,address_line2, address_line3,etc. If the data doesn't contain an address_line2 then the blank line is removed from the word document which is what I wantt.

It works fine for all the documents I have except for the one attached, and I have no idea why. (I removed some of the sensitive info) . Any help is greatly appreciated

Below is my code

Dim doc As Document = New Document(sFilePath & sFileName & ".DOC")

doc.MailMerge.RemoveEmptyParagraphs = True



''Save the document

doc.Save(sFilePath & sFileName & "_Merged.DOC", SaveFormat.FormatDocument)

Return sFileName & "_Merged.DOC"

RemoveEmptyParagraphs does not work on paragraphs that contain other characters besides merge fields. Try to substitute leading spaces with indents in your template. It should work correctly after this.