I have a project that needs to produce a line graph using data from a query. The data and the chart need to be ateast downloadedable to Excel. I have figured a way to use a Excel template and POI to modify the data, but this will be a web application, so I need the resulting Excel file to be displayed on a JSP. Is there a way for a JSP to display an Excel file that contains a graph ?
Displaying the excel sheet is easy enough - just embed the object reference in your HTML. However if you have to build the spreadsheet then display it, this is very awkward. I had a simmilar requirement a few years back and the work involved made it not worthwhile. In the end we used Corda's Popcharts product and ditched Excel all together. Its pretty good for generating graphical displays.
If you have an Excel file created using POI, it's simply a matter of creating a servlet that streams that file to the client (setting the correct content-type). If you embed a reference to the servlet in your JSP (I think you'll need an object tag to the excel ActiveX control) that's all there is to it (or easier, just a link popping up in a new window and let IE figure out how to display it).