Generating excel report from ResultSet

Hi All,

In my web application I have some reports that are generated by running the query and importing the ResultSet into the workbook. Is there a util class or sample code that helps to format the column headings and column formatting based on Result Set Metadata?



Thanks for your query.

Well, applying formatting based on metadata is not supported in the product (Aspose.Cells for Java). To manipulate formatting for data imported from ResultSet flexibly, you have to try setting custom styles for those cells (column header and details cells) manually via Aspose.Cells APIs (see the documents in the sections/sub-sections:
By the way, we do provide APIs for importing ResultSet and applying some simple formattings for the underlying data, such as the following overloaded version of the method for Cells class:
importResultSet(java.sql.ResultSet rs,
int rowIndex, int columnIndex,
bool isFieldNameShown,
String customDateFormatString,
bool convertStringToNumber)
this method can format all DateTime values to given fixed patterns, see the last parameter of the method, see the document on data importing options provided by Aspose.Cells for Java here:

So, you can try it first, if it does not fit your requirement, kindly describe your requirements with more details, so we could look into it to check whether we can support or provide some solution for it.

Thank you.