Free Support Forum - aspose.com

Aspose.Words java - executeWithRegions

Hi,

I have a document that contains 3 separate tables of the same format. Currently I'm using executeWithRegions to successfully populate one of the tables, to get this working I have defined the following

1. Customer java class with all attributes named after the merge fields in the table

2. CustomerListClass with all required methods

3. Class that implements IMailMergeDataSource with all required methods

Is there a way to populate the 2nd and 3rd table with different customer data without having to define the 3 classes above for each table, as the class content will be the same?

Table 1

Header

Header

Header

«TableStart:customer »some text «name» some more text and another «dob»

More text «age» text «hobby»

«address»

«previousaddress»

«TableEnd:customer2»

Table 2

Header

Header

Header

«TableStart:customer2 »some text «name» some more text and another «dob»

More text «age» text «hobby»

«address»

«previousaddress»

«TableEnd:customer2»

Table 3

Header

Header

Header

«TableStart:customer3»some text «name» some more text and another «dob»

More text «age» text «hobby»

«address»

«previousaddress»

«TableEnd:customer3»

I can't seem to

Hi,

Yes, you have to override IMailMergeDataSource.getTableName() method. The method should return a table name (“customer” or “customer2” or “customer3” in your template).

Best regards,