File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes Web report to Excel attachment in email Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Web report to Excel attachment in email" Watch "Web report to Excel attachment in email" New topic
Author

Web report to Excel attachment in email

Murali Narayanaswamy
Greenhorn

Joined: May 29, 2007
Posts: 24
Hi,
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.

Thanks
Murali Narain
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41863
    
  63
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).


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web report to Excel attachment in email