Question about HSSFSheet - Default Name on CreateSheet

May 4, 2010 at 7:55 PM

I'm curious why the default name on CreateSheet is "Sheet0" vs. "Sheet1".  I know this is the lowest ordinal, but I've never seen an Excel sheet labeled "Sheet0".  I've hard-coded the name "Sheet1" into the constructor, but I kinda expected it to do this for me automatically.


HSSFSheet sheet = workbook.CreateSheet();  // Results in "Sheet0"

You thoughts?


** Being my first post, I wanted to say Thank You Very Much... This has been a huge help in a new project I've been working on and using the latest 1.2.2 alpha I've been able to do 90% of what I needed.


May 4, 2010 at 11:48 PM

Code in HSSFWorkbook.cs

_sheets.Add(sheet); //a new sheet added
workbook.SetSheetName(_sheets.Count - 1, "Sheet" + (_sheets.Count - 1));

This is why the default name is "Sheet0"