Free Support Forum -

Delete text from document?

Hi it is possible after mail merge to delete Title text if Table returns nothing.
if I’ve

Title doc :

Then if there are no value to fill “MailMergeField”, we want to delete Title doc that is a fixed text on my document.


Sure, place the static text and the merge field into the same paragraph ans set MailMerge.RemoveEmptyParagraphs to true.

Thank you I tried this but it does not work !!

doc = new Document(Server.MapPath("") + “\Documents\SEIGNEURIE.doc”);

doc.MailMerge.RemoveEmptyParagraphs = true;


doc.MailMerge.MergeImageField += new MergeImageFieldEventHandler(HandleMergeImageField);


If the code is correct, how can we create paragraph in documents ?

Yes, the code seems to be correct and should work properly.

Turn show formatting marks on (click Paragraph mark button on the Standard toolbar) and make sure that there is no end of paragraph mark (Paragraph mark) between the static text and the merge field. Remove it if needed.

Thank you, if I remove paragraph marks , I we’ll all my text in the same line.
It is possible to remove paragraph marks and keep paragraph format ?

You can insert line breaks by pressing Shift+Enter or selecting Start new line from the Insert->Break menu.