• 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Web report to Excel attachment in email

Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The jsp page on submit, runs some query and get me report having various columns and rows. The jsp page has two links now above the report.

1) View as Excel

2) Send report as an Excel attachment.

The first link works fine for me, because I need to set the content type as response.setContentType("application/vnd.ms-excel"); and the entire contents in web page are translated to excel and dialog box is prompted to user whether to save or open the excel file.

The second link "Send report as an Excel attachment" is not working as the attachment is not sitting inside the email. On click of the second link "Send report as an Excel attachment", I am opening a new pop page with To, Cc, Subject and Text fields required for sending email, but the excel sheet fails to get into the email jsp.

Would greatly appreciate for any pointers to this.

Murali Narain
Posts: 43009
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As to #1, it helps to be clear that no Excel file is actually being created. What the code does is to have Excel open an HTML page which contains a table (which Excel then transforms into a spreadsheet).

As to #2, that link is apparently a "mailto:" URL, correct? That's a client-side thing and has no access to any server-side resources. The address, subject and body come from the URL; it's not possible to somehow embed the web page in it.

If you really need to send mail, then you need to do so on the server, using the JavaMail API (which can handle attachments, if you manage to create a file for Excel to read).
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!