This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Pass the name of the excel through servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Pass the name of the excel through servlet" Watch "Pass the name of the excel through servlet" New topic
Author

Pass the name of the excel through servlet

Vanitha Pai
Greenhorn

Joined: Mar 27, 2012
Posts: 9

Hi All,

I have a download functionality in my program that opens an excel sheet on click of a button on the JSP. How can I specify the name of the excel through servlet when the document opens? Also I want to give different names for the worsheets inside the excel sheet,how do I do that? Please help me in this since I have no idea about this.

Thanks in advance.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
You can use a library like Apache POI to alter the sheet names before you stream the file to the client. Set the Content-Disposition response header for how to give a name to the file.
Vanitha Pai
Greenhorn

Joined: Mar 27, 2012
Posts: 9

Tim Moores wrote:You can use a library like Apache POI to alter the sheet names before you stream the file to the client. Set the Content-Disposition response header for how to give a name to the file.


Thanks a lot, that worked great!
Archana Honnavalli
Ranch Hand

Joined: Feb 26, 2008
Posts: 39
Yes Apache POI works great for both xls and xlsx files.
I am using this jar to extract each cell value.

However cells with custom defined styles other than "General" will pose some challenges while extracting values. So be a lil careful.
Vanitha Pai
Greenhorn

Joined: Mar 27, 2012
Posts: 9

Archana Honnavalli wrote:Yes Apache POI works great for both xls and xlsx files.
I am using this jar to extract each cell value.

However cells with custom defined styles other than "General" will pose some challenges while extracting values. So be a lil careful.


Hi Archana,

Thanks for mentioning that. However, I noticed this behaviour during the implementation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pass the name of the excel through servlet
 
Similar Threads
Download excel file with images
Error in excel sending additional request
writting to excel sheet through java
how to store values(data) from excel into mysql
Editing an existing Excel Sheet through web