Hi,
I’m a novice in Java. I’m trying to populate a dynamic table (having two columns: EmpName and Location) in a Word document template using mail merge. The template i’m using has the fields like:
«TableStart:Employee»«EmpName» | «Location»«TableEnd:Employee» |
---|
and the my code is:
ResultSet r = s.executeQuery("SELECT EmpName, Location FROM EmployeeDetails");
Document doc1 = new Document("C:\\EmpTemplate.doc");
String fields[] = doc1.getMailMerge().getFieldNames();
for (int i = 0; i < fields.length; i++)
{
System.out.println(fields[i]);
}
doc1.getMailMerge().executeWithRegions("Employee", r);
Please provide some suggestions on the same.
Thanks in Advance.