poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Danny Mui <da...@muibros.com>
Subject Record Reordering - Print Areas
Date Thu, 02 Jan 2003 17:31:06 GMT
In struggling with Print Areas for the past few days, I finally figured 
out why the thing crashed on me.  Thank you guys for the hints on my 
first foray into BIFF records.

In the HSSFName class, the externsheet setting and indextoSheet stuff is 
encapsulated in the setSheetName method to protect the innocent in 
making excel files that dies a fiery death.  This is problematic when 
defining print areas because they are specific to an individual sheet. 
 I also found that this shielding yields global named regions no matter 
what sheetname is supplied.

So when I forced a sheet index into the correct offset, the spreadsheets 
would crash.

In order to match the excel generated files as best as possible, I had a 
hunch that the extern sheet definition and name region definition had a 
reference problem.  An Extern sheet record was defined before the bound 
sheet record was defined.

This is the file format that crashed Excel:

[SUPBOOK]
[EXTERNSHEET]
[NAMEs]
...fonts/styles/etc...
[USESELFS]
[BOUNDSHEETs]

I reordered the records such that it matched excel-generated files:

...fonts/styles/etc...
[USESELFS]
[BOUNDSHEETs]
[SUPBOOK]
[EXTERNSHEET]
[NAMEs]

After making this change, the unit tests are still ok and the Print 
Areas/Named regions work fine for their specific sheets.  If nobody has 
any objections, I'll clean up the code and send it up to Bugzilla.  It 
partially addresses Bug 14089 so I'll create a new one.

Thanks!

danny


Mime
View raw message