You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Osman Çınar Eren <Ci...@isbank.com.tr> on 2005/04/05 10:40:21 UTC

reading excel file

hi,
 
i have downloaded the binary version of poi. I included poi-2.5.1-final-20040804.jar in my classpath.
i want to move the content of the excel file into a text file. first i tried the event based model but i guess i missed something:
i expected to see the rows in a logical order, such as first a RowRecord, then all of the Records in that ROW.
but in the output the RowRecords come one after the other. Any help?
 
then i tried the old method: open the workbook, get the sheet, get the row, get the cell...
 POIFSFileSystem fs      =
                new POIFSFileSystem(new FileInputStream("C:\\H2.xls"));

        HSSFWorkbook wb = new HSSFWorkbook(fs);
 
in the last line, i get the following exception:
Exception in thread "main" java.lang.ClassCastException
        at java.util.TreeMap.compare(TreeMap.java:1085)
        at java.util.TreeMap.put(TreeMap.java:463)
        at org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.insertCel
l(ValueRecordsAggregate.java:65)
        at org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.construct
(ValueRecordsAggregate.java:130)
        at org.apache.poi.hssf.model.Sheet.createSheet(Sheet.java:210)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1
72)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1
30)
        at poi.Poi.main(Poi.java:32)
 
any ideas?
 
i will greatly appreciate any help.
thanks in advance.
best regards..