The following error occured --------------------------- Exception in thread main java.lang.NullPointerException at org.apache.poi.hssf.model.Sheet.getNumColumnBreaks(Sheet.java:2721) --------------------------- in the following code --------------------------- import java.io.FileInputStream; import java.io.IOException; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; public class GridSetError { public GridSetError( String fileName ) { System.out.println( "fileName : " + fileName ); try { POIFSFileSystem pfs = new POIFSFileSystem( new FileInputStream( fileName ) ); HSSFWorkbook sourceWorkbook = new HSSFWorkbook( pfs ); HSSFSheet sourceSheet = sourceWorkbook.getSheetAt( 0 ); System.out.println( sourceSheet.getColumnBreaks() ); } catch( IOException ioE ) {} } public static void main(String[] args) { if( args.length > 0 ) { GridSetError gridSetError = new GridSetError( args[0] ); } } } --------------------------- Source XLS DOES NOT contain [VERTICALPAGEBREAK] record. I think, Sheet.getNumColumnBreaks() ( and Sheet.getNumRowBreaks() ) should first test if Sheet.colBreaks (and Sheet.rowBreaks) is not null and if it is, then return 0 to HSSFSheet.getColumnBreaks() which would then return empty short[] to the caller. This would not result in exception.
Could you please attach a (stripped down) copy of the sheet that is causing you this problem?
Created attachment 15564 [details] Test Excel file
Works as of 12Jan2007, Testcase added. http://issues.apache.org/bugzilla/show_bug.cgi?id=41366