Excel 2003 puts out an error message when opening a POI-produced excel workbook which - was created from an existing excel workbook file - contained sheets with PageSetup.PrintTitleRows set and - one of those sheets is removed from the workbook before saving. public class TestRepeatingRowsAndColumns { public static void main(String args[]) { try { test(); } catch (Exception e) { e.printStackTrace(); } } public static void test() throws Exception { java.io.FileInputStream fis = new java.io.FileInputStream("test.xls"); //http://www.mbisping.de/test.xls org.apache.poi.poifs.filesystem.POIFSFileSystem fs = new org.apache.poi.poifs.filesystem.POIFSFileSystem( fis); HSSFWorkbook wb = new HSSFWorkbook(fs); fis.close(); int sheetCount = wb.getNumberOfSheets(); //removing repeating Rows/Cols before deleting doesn't help wb.setRepeatingRowsAndColumns(sheetCount-1,-1,-1,-1,-1); wb.removeSheetAt(sheetCount-1); FileOutputStream out = new FileOutputStream("testout.xls"); wb.write(out); out.close(); } }
The provided link (http://www.mbisping.de/test.xls) is invalid. Can you attach the problem file so that we can reproduce the trouble? Yegor
No update for a long time => Resolving this issue.