I have a merge field in a .dot file that looks like this
- Code: Select all
{ IF { MERGEFIELD B26STATE_CODE } = 34 "Some Text For State 34" "" }
When I run this code
- Code: Select all
cols[0] = "B26STATE_CODE";
data[0] = "34";
document.IsUpdateFields = true;
document.MailMerge.Execute(cols, data);
document.ViewSetup.DocumentViewType = DocumentViewType.PrintLayout;
document.Document.SaveToFile("test-out.pdf", FileFormat.PDF);
document.MailMerge.MailMergeMainDocumentType = MailMergeMainDocumentType.NotAMergeDocument;
document.SaveToFile("test-out.doc", FileFormat.Doc);
document.SaveToFile("test-out.docx", FileFormat.Docx);
in the PDF, I see this
Some Text For State 34
In the DOC and DOCX, I see this
{ IF 34 = 34 "Some Text For State 34" "" }
Is there something I'm missing when executing the merge?
(note: I'm setting that "NotAMergeDocument" thing because the templates sometimes have queries associated with them, and setting that makes sure that the output document doesn't have that stuff in it)