I tried to output my html tables into the excel sheet just by setting the response.setContentType method and got succeeded without using any APIs like POI or JXL. Now, can anyone help me to create a multiple workshhets in the same excel file without any APIs and just by using the servelt's setContentType method only..
Ulf Dittmer wrote:I'm 99% sure that this can't be done, because Excel does not support this.
Which one is not possible? Creating the Excel file or creating multiple sheets in a single excel file??
Joined: Mar 22, 2005
It is easily possible to create an Excel file containing multiple sheets using a library like Apache POI. What I don't think is possible is to create HTML tables, and somehow have Excel import that into a document containing multiple sheets (which is what you asked).
My name is Ulf, by the way. If you prefer to call me by my last name, then the polite way to do so is to call me "Mr. Dittmer". First name is fine, though.
I believe you have set the response object's content type to the following.
It means the response object writes this data to ms-excel format.
Serlvet API can only set the content type to microsoft excel format. There is no API for creating for multiple workbook.
If you have verified the generated xls file, you could have noticed only one worksheet possibly without the grey lines. Servlet API supports only the content type to microsoft excel, but not the Excel creation API.
If you have table data or results put it into an arraylist , initialize the jxl write class to write it to multiple worksheet.
Till now Oracle Corp, has not found Servlet API to create excel worksheets.
Ronald Reagan Jr
Joined: Nov 05, 2012
Thanks for your clarification. Now i am clear that we can generate only one work sheet in the excel using servlets. In order to create multiple worksheet we need to use Java Excel APIs like JXL or APache POI.