Hi,
I use POI 2.5.1 so far and plan to migrate to 3.1 now and actually do
the first tests -- and they fail.
Purpose of POI for me: Generate XLS files (simple tables, 1 sheet per
WB) from scratch for download by Windows users
Scenario: My code queries a DB and prepares lists from the results as
Excel files for download by users. No formulas, no special data, no
embedded objects. Formatting only requires things like boldface and
borders and repeatable rows / freeze panes.
Problem with 3.1 final (20080629): When I start to generate and fill a
new workbook from scratch, I receive:
java.lang.IllegalStateException: Cannot create value records before row
records exist
Code dealing with POI HSSF looks like:
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet(name);
// name.equals("Vorschauliste")
HSSFRow row = sheet.createRow((short)xlsZeile);
// xlsZeile == 0
HSSFCell cell = row.createCell((short)0);
Stack trace of POI code is:
[27.08.08 13:25:06:825 CEST] 00000020 SystemErr R
java.lang.IllegalStateException: Cannot create value records before row
records exist
at org.apache.poi.hssf.model.Sheet.checkCells(Sheet.java:497)
at org.apache.poi.hssf.model.Sheet.addValueRecord(Sheet.java:1041)
at
org.apache.poi.hssf.usermodel.HSSFRow.createCell(HSSFRow.java:134)
at
org.apache.poi.hssf.usermodel.HSSFRow.createCell(HSSFRow.java:115)
at
de.dc.jnet.frame.servlet.XLSViewSrv.specialList(XLSViewSrv.java:1605)
// last row: my code.
I looked around and found that there were the following changes in the
code base which may belong to this problem:
Bug: https://issues.apache.org/bugzilla/show_bug.cgi?id=45145
SVN: r663765
I inspected the source code around the stack trace and found that in
Sheet.checkCells() a condition (dealing with the binary sequence of data
records building the Excel file) is checked, but nothing is done before
in "my sequence of calls" to meet this condition. Moreover, I cannot
force or tackle things like dimsloc in my code since they are part of
the private HSSF data model.
What can I do to get my code work with 3.1? (I do not plan to use
template files.)
tia,
--
Dipl.-Inform. Christian Gosch
Systems Development
inovex GmbH
Karlsruher Strasse 71
D-75179 Pforzheim
Tel: 07231 3191-85
Fax: 07231 3191-91
[EMAIL PROTECTED]
www.inovex.de
Sitz der Gesellschaft: Pforzheim
AG Mannheim, HRB 502126
Geschäftsführer: Stephan Müller
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]