• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Any idea on Export an Excel Sheet in GWT

 
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
 
Sheriff
Posts: 21788
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our GWT forum.
 
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".
 
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.
 
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 ?
 
Bring out your dead! Or a tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!