I have developed a web application using JSP which creates a page with several page elements and a with multiple records. I wanted to export the content in that into an excel file.
I used the code
response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "inline; filename=" + "excel.xls"); as described in this article http://www.quicklyjava.com/export-web-page-to-excel/
But it exports the whole page. How can a export only the content in that particular table?
I cannot use the Apache POI library since i have to format(text colors,cell colors) the content in the JSP. And i need the same formatting in the excel file.
Can somebody help me with this? :)
application/vnd.ms-excelin it.<input type="submit" value="Export to Excel" />to call the page with the Excel content type and the table content, nothing else. In this way, your initial page keeps intact and your new page contains the same table/data.