We are doing the Mail merge in Labels .
If the data on any field is not coming then it is leaving the Blank line in it . Check the attachment "result-2.doc" . The 1st and 5th label has blank lines .
We even used "RemoveEmptyParagraphs" but still it is showing blanks .
Also we want the Blank Labels which do not have data should not come with Merge Fields . That means if the template have 10 labels and the Datasource is returning only 6 lables , then the rest 4 should be blank .
But in the attached doc it shows the Merge fields for them
Below is the code:
Document doc;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
// Open an existing document.
doc = new Document(filename);
doc = new Document(defaultfilename);
doc.MailMerge.RemoveEmptyParagraphs = true;
// Fill the fields in the document with user data.
// Send the document in Word format to the client browser.
doc.Save(Globals.EventAttendeesPrintDocName, SaveFormat.Doc, SaveType.OpenInBrowser, Response);
where filename is the template file(Label Template.docx) on which MailMerge to run.