@amitpatelbnft,
Regarding WORDSNET-20477, we have made a few changes to the code; please check on your end and let us know if the following code changes (mRecordIndex = 0, updateFields()) are acceptable for you?
public void SimpleTest() throws Exception
{
test("testTemplateWithIF.docx");
test("testTemplateWithoutIF.docx");
}
private void test(String input) throws Exception
{
String inputFile = "X:\\tmp\\WORDSNET-20477\\" + input;
Document baseDoc = new Document(inputFile);
baseDoc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_UNUSED_FIELDS);
baseDoc.getMailMerge().setMergeDuplicateRegions(false);
mergeDataToDocument(baseDoc, buildUserHeaders(), "userTableHeader");
mergeDataToDocument(baseDoc, buildUsers(), "usersTable");
mergeDataToDocument(baseDoc, buildUsers(), "childTable");
baseDoc.updateFields();//!! added
baseDoc.save(inputFile + ".out.0.index.with.update.docx");
}
public TestMapDataSource(List<Map<String, Object>> mapList, String tableName)
{
this.mapList = mapList;
this.tableName = tableName;
mRecordIndex = 0;//!! was -1
}