I am using POI API to read a template n to create an XLS file through java.
I want to get the chart from the template. IS there any way to do so?
I am using POI API to read a template n to create an XLS file through java.
I want to get the chart from the template. IS there any way to do so?
Do you mean a way to get a GIF or JPEG? Actuate e.Spreadsheet can create images from Excel charts and ranges, but it's expensive (I worked there until 2002 but have no affiliation now).
If you build the chart into the template it will automatically update when you insert data into the spreadsheet.
If you are wanting to create a chart from scratch I believe that this functionality is not yet available in POI.
from the POI site:
You can not currently create charts. You can however create a chart in Excel, modify the chart data values using HSSF and write a new spreadsheet out. This is possible because POI attempts to keep existing records intact as far as possible.
Maybe Andy Khan's JExcel can help you. It's a terrific tool. I much prefer it to POI.
// officetools.jar available at http://www.dancrintea.ro/xls-to-pdf/
import officetools.OfficeFile;
FileInputStream fis=new FileInputStream(new File(”test.xls”));
OfficeFile f=new OfficeFile(fis,”localhost”,”8100″, false);
// read a column for(int i=0;i<=99;i++) System.out.println( f.getCell(1,i) );