My code was working fine and suddenly I started getting the message above
here is the code:
var serializer = new XmlSerializer(typeof(PrintPaymentRecord));
var stream = new MemoryStream();
serializer.Serialize(stream, PrintRecord);
//create xml from the stream
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
stream.Position = 0;
var xml = reader.ReadToEnd();
DataSet ds = new DataSet();
ds.ReadXml(new StringReader(xml));
doc.MailMerge.FieldMergingCallback = new HandleMergeField();
doc.MailMerge.UseNonMergeFields = true;
doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveUnusedFields;
//mail merge
doc.MailMerge.ExecuteWithRegions(ds);
The error occurs on the last step
I’ve attached the xml file generated by the code
Hi Michael,
- Your input Word document
- Please create a standalone Console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing…