Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any idea on Export an Excel Sheet in GWT

 
Harsha Bandaru
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our GWT forum.
 
Duc Vo
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
Maneesh Godbole
Saloon Keeper
Posts: 11092
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Harsha Bandaru
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic