Creating a document template

I am trying to create a document template and use aspose to merge it with an XML file, however the fields are not being replaced. I believe it may be related to how I am adding the field list. I can use the example xml and template in your example project and it works fine but not with my xml or template.

Hi

Thank you for contacting support. Please let us know which Aspose APIs are you using and what is the development platform (e.g. .NET/Java). Please also provide us your source template file, XML file and sample code for testing purposes in this forum thread. We’ll investigate and reply you accordingly.

We’re looking forward to help you.

entity.xml contains the data. Greetings.doc is the template. EntityFieldList.csv is the list of fields imported into Word. The fields are then selected by using the insert field drop down. We are using Aspose Words in .Net

public static void ToReplacedTokenStreamFromXML(Stream templateStream, DataSet ds, String path)
{
    String s = ds.ToString();
    Aspose.Words.License license = new Aspose.Words.License();
    license.SetLicense("C:\\Users\\jlm\\Documents\\Visual Studio 2013\\Projects\\ChildDataSetMailMergeTest\\ChildDataSetMailMergeTest\\Aspose.Words.lic");
    Aspose.Words.Document doc = new Aspose.Words.Document(templateStream);
    doc.MailMerge.ExecuteWithRegions(ds);
    doc.Save(path + "Merge.Doc");
    Debug.Assert(doc.MailMerge.GetFieldNames().Length == 0, "There was a problem with mail merge");
}

templateStream contains the template.
DataSet contains the XML
path is the save path for the document

Hi,

Thanks for your inquiry. After an initial test with Aspose.Words for .NET 15.8.0, I was unable to reproduce this issue on my side (please see attached 15.8.0.pdf). I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link. I hope, this helps.
https://releases.aspose.com/words/net

I used the following code for testing on my end:

Document doc = new Document(MyDir + @"Greetings.doc");
DataSet ds = new DataSet();
ds.ReadXml(MyDir + "entity.xml");
doc.MailMerge.Execute(ds.Tables[0]);
doc.Save(MyDir + @"15.8.0.docx");

Best regards,