Free Support Forum - aspose.com

How can I produce multiple DataTable by a loop?

In our application, there is a requirement that the data need to be grouped by some fields.

For example,
There is a POJO InvoiceItem (category, name, amount), and a database query produces a list of InvoiceItem (by hibernate query). And we want to use Aspose.Word to generate PDF based on these data.
The problem is we want to group DataTables by fields (category in this case), and add subtotal on each subtable.
Is it possible to do so by Aspose? And how can I do that?
I think there should be a way of producing DataTable or doing mailmerge in a loop, am I right?

Hi Guilin,


Thanks for your inquiry.
Zuora:
There is a POJO InvoiceItem (category, name, amount), and a database query produces a list of InvoiceItem (by hibernate query). And we want to use Aspose.Word to generate PDF based on these data.
Yes, you can generated PDF file based on data source. Moreover, the data which comes from a ResultSet (the result of a database query) is wrapped into an Aspose.Words class called DataTable. Many DataTable objects can be added to a DataSet. (These classes mimic the basic functionality of DataTable and DataSet in .NET and allow to more easily merge complex hieratical data into documents.)
I suggest you please read following documentation links for your kind reference.
http://www.aspose.com/docs/display/wordsjava/How+to++Execute+Simple+Mail+Merge
http://www.aspose.com/docs/display/wordsjava/How+to++Execute+Mail+Merge+with+Regions
Zuora:
The problem is we want to group DataTables by fields (category in this case), and add subtotal on each subtable.
Is it possible to do so by Aspose? And how can I do that?
I think there should be a way of producing DataTable or doing mailmerge in a loop, am I right?
I have tried to understand your query but unfortunately I have not completely understood your query. It would be great if you please share some more information about your query.

Please attach your input Word document and target PDF here for our reference. I will investigate how you are expecting your final PDF document?