This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

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: 21866
105
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 ?
 
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!