Nowadays, many reports are generated as HTML documents for access on the Web. This tip shows you how to export that HTML data as it is (including all the CSS styles, tables borders, etc.) into an
.xls file which can be saved and used as you need it.
Include the following code in the .jsp page that generates the report/HTML page:
String mimeType = "application/vnd.ms-excel";
response.setContentType(mimeType);
The output is transferred to an
.xls document.
Please Note: Microsoft Excel must be installed on the client's computer for this to work.
If you have a hot tip and we publish it, we'll pay you. However, due to accounting overhead we no longer pay $10 for a single tip submission. You must accumulate 10 acceptable tips to receive payment. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible.
Submit your tip here.