Bug 59300

Summary: default sheet name for the 1st sheet has to be "Sheet1" instead pf "Sheet0"
Product: POI Reporter: Vladimir Dolzhenko <vladimir.dolzhenko>
Component: SS CommonAssignee: POI Developers List <dev>
Status: RESOLVED WONTFIX    
Severity: enhancement    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Vladimir Dolzhenko 2016-04-11 15:42:11 UTC
When MS Excel, Libreoffice opens - they create an empty spread sheet with name "Sheet1". 

XSSFSheet (and potentially other implementations) calls it "Sheet0" that is inconvenient. 

    public XSSFSheet createSheet() {
        String sheetname = "Sheet" + (sheets.size());
        int idx = 0;
        while(getSheet(sheetname) != null) {
            sheetname = "Sheet" + idx;
            idx++;
        }
        return createSheet(sheetname);
    }


it is worth to change it to 

    public XSSFSheet createSheet() {
        String sheetname = "Sheet" + (sheets.size() + 1);
        int idx = 0;
        while(getSheet(sheetname) != null) {
            sheetname = "Sheet" + idx;
            idx++;
        }
        return createSheet(sheetname);
    }
Comment 1 Javen O'Neal 2016-05-17 23:39:23 UTC
This probably won't be fixed as it introduces a behavior change that may subtly break existing applications, with marginal benefit.

If you need your sheet names to start at "Sheet1", use Workbook#createSheet(String name).