Hi,
I’m trying to use data feed into the C# app to populate the merge marks but only working when I have one merge mark and not multiple.
It works when it’s C:\Temp|Template_INVOICE|“Contact_Details”|“James Bond”
But when I’m feeding this in C:\Temp|Template_INVOICE|Contact_Details,Company_Name|“James Bond”,“M1” it doesn’t.
Code being used:
class MailMerge
{
static void Main(string[] args)
{
var arguments = string.Join("|", args).Split(’|’);
if (arguments.Length > 1)
{
var Directory = arguments[0];
var TemplateNm = arguments[1];
var MergeFields = arguments[2];
var MergeData = arguments[3];
Document doc = new Document(Directory + TemplateNm + ".doc");
doc.MailMerge.TrimWhitespaces = false;
doc.MailMerge.Execute(
new string[] { MergeFields },
new object[] { MergeData });
PdfSaveOptions so = new PdfSaveOptions();
so.PreserveFormFields = true;
string OutputFile = Directory + TemplateNm + "_OUT.pdf";
doc.Save(OutputFile, so);
}
}
}
Thanks