Bug 40829 - file corrupt if sheets with printTitleRows set are removed
Summary: file corrupt if sheets with printTitleRows set are removed
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: All Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-27 07:35 UTC by Meikel Bisping
Modified: 2014-07-28 18:01 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Meikel Bisping 2006-10-27 07:35:26 UTC
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();
         
    }
}
Comment 1 Yegor Kozlov 2009-04-18 03:26:24 UTC
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
Comment 2 Dominik Stadler 2014-07-28 18:01:54 UTC
No update for a long time => Resolving this issue.