Bug 24215 - RuntimeException: UnImplemented Celltype -1 when handling excel-file.
Summary: RuntimeException: UnImplemented Celltype -1 when handling excel-file.
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-29 12:31 UTC by poi
Modified: 2005-03-20 17:06 UTC (History)
0 users



Attachments
Handling of this excel document fails (17.00 KB, application/octet-stream)
2003-10-29 12:33 UTC, poi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description poi 2003-10-29 12:31:22 UTC
Excel sheet processing fails and causes:

java.lang.RuntimeException: UnImplemented Celltype -1
        at org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.construct
Record(ValueRecordsAggregate.java:361)
        at org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.getCell(V
alueRecordsAggregate.java:98)
        at org.apache.poi.hssf.model.Sheet.getValueRecord(Sheet.java:557)
        at org.apache.poi.hssf.usermodel.HSSFRow.getCell(HSSFRow.java:325)
        at bug.ExcelBug.main(ExcelBug.java:27) 

Sample file is provided an attachment.

Sample code:
-------------------------

package bug;

import java.io.FileInputStream;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class ExcelBug {
    
    public static void main(String args[]) {
        try {
            HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream
("test.xls")); 
    
            for (int sheetIndex = 0; sheetIndex < wb.getNumberOfSheets(); 
sheetIndex++) {
                HSSFSheet sheet = wb.getSheetAt(sheetIndex);
                int rows = sheet.getLastRowNum();
    
                for (int rowIndex = 0; rowIndex < rows; rowIndex++) {
                    
            
                    HSSFRow row = sheet.getRow(rowIndex);
                    int cells = row.getLastCellNum();
    
                    for (short cellIndex = 0; cellIndex < cells; cellIndex++) {
                        HSSFCell cell  = row.getCell(cellIndex);
                    }
                }
            }
            
        } catch(Throwable t) {
            t.printStackTrace();
        }
        
    }
}
Comment 1 poi 2003-10-29 12:33:00 UTC
Created attachment 8801 [details]
Handling of this excel document fails
Comment 2 Avik Sengupta 2003-10-30 16:27:25 UTC
Works with latest CVS. testcase added.