I would like to modify a workbook including a sheet with an chart on it. Trying to do this I always running into trouble. Modifying a workbook without a chart in it works without problems. Sometimes the error occurs when I would like to open the Workbook (file workbook.xls) java.lang.NullPointerException at org.apache.poi.hssf.usermodel.HSSFSheet.setPropertiesFromSheet (HSSFSheet.java:171) at org.apache.poi.hssf.usermodel.HSSFSheet.<init>(HSSFSheet.java:134) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init> (HSSFWorkbook.java:154) at net.gedas.ecu.servlet.util.FehlerAuswertung1Helper.main (FehlerAuswertung1Helper.java:131) Sometimes it occurs when I would like to write the workbook back to the file FehlerAuswertung1.xls: java.lang.ArrayIndexOutOfBoundsException at org.apache.poi.util.LittleEndian.putNumber(LittleEndian.java:550) at org.apache.poi.util.LittleEndian.putShort(LittleEndian.java:242) at org.apache.poi.hssf.record.SelectionRecord.serialize (SelectionRecord.java:261) at org.apache.poi.hssf.model.Sheet.serialize(Sheet.java:584) at org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes (HSSFWorkbook.java:513) at org.apache.poi.hssf.usermodel.HSSFWorkbook.write (HSSFWorkbook.java:465) at net.gedas.ecu.servlet.util.FehlerAuswertung1Helper.main (FehlerAuswertung1Helper.java:163) I have run the file with the charts against Biffviewer and there are unknown records in it. Whatever this means :-( On the POI-homepage I have found the following description: "You can not currently create charts. This is planned for the 2.0 release. 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." In my opinion this is exactly what I want to do! Why does it not work? Kind regards, Arne Clauß
Created attachment 2394 [details] File which isn't working on my comp
Please check -- Glen
Hello Glen! The part with the workbook.xls is working very fine now. The second error with the file FehlerAuswertung1.xls is still present! In the first file file (workbook.xls) the chart is a seperate sheet, whereas in the second file (FehlerAuswertung1.xls) the chart is a part of a table sheet. Thanks a lot for your work until now, Regards, Arne
Created attachment 2433 [details] File with a chart included in a table sheet
Somehow I missed that second attachment altogether! Sorry about that. I'll take a look when I next have some Poi time.
Looks this may be a tough one to fix. It appears to be related to the formula's you're including in the sheet. The are actually creating a STRING record that Poi currently doesn't handle. Will continue looking into a solution for this problem.
Okay... I think I've fixed the chart handling... BUT... The attached spreadsheet includes a VBA macro somewhere (use poi browser to see it) and since this is not supported yet we have a problem. I believe Andy is doing some work for this so either wait for that or remove your VBA macro and give it a shot. I will be committing the changes sometime in the next 24 hours (hopefully).