Delete text from document?

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

Title doc :
“MailMergeField”

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

Hi,

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.DeleteFields();
doc.MailMerge.MergeImageField += new MergeImageFieldEventHandler(HandleMergeImageField);
doc.MailMerge.ExecuteWithRegions(dataSet);

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 button on the Standard toolbar) and make sure that there is no end of 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.