This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I am new to use Apache POI / HSSF. I'm trying to read an Excel file. Here is the code:
But when I run it, I got:
java.io.IOException: block[ 0 ] already removed at org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:97) at org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks(BlockAllocationTableReader.java:190) at org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks(BlockListImpl.java:130) at org.apache.poi.poifs.storage.SmallBlockTableReader.getSmallDocumentBlocks(SmallBlockTableReader.java:61) at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:176) at MasterTable.main(MasterTable.java:29)
Dose someone know what's the problem with this code? Or is the excel input file has problem? Thanks.
Another think you might want to check is if the version of Apache POI supports file Excel file version.
A simple way to test that it's not Apache POI's fault would be to iterate through the sheets without sheets name or cell indexes(ie. using the iterators that POI provides for the sheets and rows). You'll be able to ensure that the sheet name that you're requesting correspond to the ID that POI has in memory.