If I save as another DOCX file, the values are there (although not formatted with respect to the formatting conditions), but not in the PDF version.
I've attached the sample input/output documents and code. I am using the 5.5.541 hotfix.
Is there something else I need to do for this to work upon export to PDF?
Sample Code (also in the attached zip):
- Code: Select all
var DocxIn = @"c:\mergetest_in.docx";
var DocxOut = DocxIn.Replace("_in", "_out");
var PdfOut = Path.ChangeExtension(DocxOut, "pdf");
var Docx = new Document(DocxIn, FileFormat.Docx);
Docx.MailMerge.MergeField += MailMerge_MergeField;
Docx.MailMerge.Execute(
new[] {"Some Field"},
new[] {"some replacement value"}
);
// before/after fields present
Docx.SaveToFile(DocxOut, FileFormat.Docx);
Process.Start(DocxOut);
// before/after fields NOT present
Docx.SaveToFile(PdfOut, FileFormat.PDF);
Process.Start(PdfOut);
Edit: I see hotfix 5.5.71 is listed as having fixed this. Apparently the bug is back =(