Hi,
I’m testing Aspose Words 9.1.0 and 9.2.0
I made a template like this :
MERGEFIELD TableStart:TABLE0
[cell][cell][cell]
[cell MERGEFIELD TableStart:TABLE1][cell MERGEFIELD data][cell MERGEFIELD TableEnd:TABLE1]
MERGEFIELD TableEnd:TABLE0
I’m using a dataset with TABLE0 and TABLE1 datatable.
code :
if (File.Exists(@"path\out.doc"))
File.Delete(@"path\out.doc");
if (File.Exists(@"path\out_withData.doc"))
File.Delete(@"path\out_withData.doc");
if (File.Exists(@"path\out_withoutData.doc"))
File.Delete(@"path\out_withoutData.doc");
Document doc = new Document();
DocumentBuilder db = new DocumentBuilder(doc);
db.InsertField("MERGEFIELD TableStart:TABLE0");
db.InsertCell();
db.InsertCell();
db.InsertCell();
db.EndRow();
db.InsertCell();
db.InsertField("MERGEFIELD TableStart:TABLE1");
db.InsertCell();
db.InsertField("MERGEFIELD data");
db.InsertCell();
db.InsertField("MERGEFIELD TableEnd:TABLE1");
db.MoveToDocumentEnd();
db.InsertField("MERGEFIELD TableEnd:TABLE0");
doc.Save(@"path\out.doc");
XmlDocument XmlDataset = new XmlDocument();
XmlDataset.LoadXml("1donne");
XmlDataset.Save(@"path\dataset.xml");
DataSet ds = new DataSet();
ds.ReadXml(@"path\dataset.xml");
File.Delete(@"path\dataset.xml");
doc.MailMerge.ExecuteWithRegions(ds);
doc.UpdateFields();
doc.Save(@"path\out_withData.doc");
doc = new Document();
db = new DocumentBuilder(doc);
db.InsertField("MERGEFIELD TableStart:TABLE0");
db.InsertCell();
db.InsertCell();
db.InsertCell();
db.EndRow();
db.InsertCell();
db.InsertField("MERGEFIELD TableStart:TABLE1");
db.InsertCell();
db.InsertField("MERGEFIELD data");
db.InsertCell();
db.InsertField("MERGEFIELD TableEnd:TABLE1");
db.MoveToDocumentEnd();
db.InsertField("MERGEFIELD TableEnd:TABLE0");
doc.Save(@"path\out.doc");
ds = new DataSet("NewDataSet");
ds.Tables.Add(new DataTable("TABLE0"));
ds.Tables.Add(new DataTable("TABLE1"));
doc.MailMerge.ExecuteWithRegions(ds);
doc.UpdateFields();
doc.Save(@"path\out_withoutData.doc");
With Aspose.Word 9.0.0, table is hidden in out_withoutData.doc.
With Aspose.Word 9.1.0 and 9.2.0, table is not hidden in out_withoutData.doc.
Did you change something ?
Is there any way to have the same fonctionality as with 9.0.0 version of aspose Words ?
(I made the same test with text inside region, with the same result. Text is not hidden when there is no row in my dataset)
Thanks