File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes GWT and the fly likes Any idea on Export an Excel Sheet in GWT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "Any idea on Export an Excel Sheet in GWT" Watch "Any idea on Export an Excel Sheet in GWT" New topic
Author

Any idea on Export an Excel Sheet in GWT

Harsha Bandaru
Greenhorn

Joined: Sep 23, 2010
Posts: 5
Hi all,

I am trying to export an excel sheet in GWT. When ever the user clicks on the Download button, a dialogue box should pop up asking the location to save the file and when the user hits submit button, an excel file should be downloaded to that location.

I am able to generate the excel sheet but i am not clear on how to show the pop up dialogue box.

Can any one help me on this problem please.

Thanks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

Moving to our GWT forum.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
To force download dialog box to appear all you need is to set the "Content-disposition" to "attachment". It's nothing much to do with GWT.
For more information google the keyword "force download html".


“Everything should be as simple as it is, but not simpler.” Albert Einstein
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Check out http://markmail.org/message/5tmtyrnmri5fl7pk


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Harsha Bandaru
Greenhorn

Joined: Sep 23, 2010
Posts: 5
Hey
I was not able to unserstand where to set the content type in GWT. Is there any sample code explaining me how to do it? I am sorry but i am in bad need of it.
Thanks for your responses.
Plutarco Gonzalez
Greenhorn

Joined: Jan 13, 2011
Posts: 2
Harsha Bandaru wrote:Hey
I was not able to unserstand where to set the content type in GWT. Is there any sample code explaining me how to do it? I am sorry but i am in bad need of it.
Thanks for your responses.


In my servlet I use this to create pdf report and send to user.

ServletOutputStream out = response.getOutputStream();
byte[] reporte = JasperExportManager.exportReportToPdf(jasperPrint);
response.setContentType("application/pdf");
response.setContentLength(reporte.length);
response.addHeader("content-disposition", "attachment; filename=\""+ reportFileName + "\"");
out.write(reporte, 0, reporte.length);
out.flush();

Harsha, how can I generate the excel sheet ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Any idea on Export an Excel Sheet in GWT
 
Similar Threads
How can you attach a file in email ?
listening to windows dialogue events in javascript
JavaScript +POI - How to pop up a Excel Sheet
Using jxl apis for prompting user to enter location for excel sheet?
Exporting HTML-Table data to EXCEL sheet