Bug 10943 - Problem when modifying a workbook with a chart included
Summary: Problem when modifying a workbook with a chart included
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 1.5.1
Hardware: PC All
: P3 normal with 3 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-18 12:13 UTC by Arne Clau
Modified: 2005-03-20 17:06 UTC (History)
2 users (show)



Attachments
File which isn't working on my comp (14.50 KB, application/octet-stream)
2002-07-18 12:15 UTC, Arne Clau
Details
File with a chart included in a table sheet (28.00 KB, application/octet-stream)
2002-07-22 07:23 UTC, Arne Clau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arne Clau 2002-07-18 12:13:14 UTC
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ß
Comment 1 Arne Clau 2002-07-18 12:15:19 UTC
Created attachment 2394 [details]
File which isn't working on my comp
Comment 2 Glen Stampoultzis 2002-07-20 07:50:50 UTC
Please check 

-- Glen
Comment 3 Arne Clau 2002-07-22 07:21:04 UTC
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
Comment 4 Arne Clau 2002-07-22 07:23:47 UTC
Created attachment 2433 [details]
File with a chart included in a table sheet
Comment 5 Glen Stampoultzis 2002-07-22 07:25:53 UTC
Somehow I missed that second attachment altogether!  Sorry about that.  I'll
take a look when I next have some Poi time.
Comment 6 Glen Stampoultzis 2002-07-28 12:50:44 UTC
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.
Comment 7 Glen Stampoultzis 2002-08-20 07:49:25 UTC
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).