Unknown Sheets

I have a Workbook with 12 Sheets in it. When I open the workbook with Aspose.Excel it tells me there are 23 sheets. This is obviously not correct? Where is Aspose getting the other sheets from? Also, as best I can tell these “Extra” sheets are not ranges either.

This is how I am getting my list of worksheets:

Should I be doing something different?



foreach( Worksheet ws in _xl.Worksheets )

{

this.uiComboBox1.Items.Add( ws.Name );

}












Could you please post your file here? There may be some hidden worksheets.

You are correct, there are 11 hidden sheets in the workbook. I now filter on the IsVisible flag.

Thanks.

@jcioffari,
Aspose.Cells has replaced Aspose.Excel that is no more under active development now. This new product Aspose.Cells has all the features of its predecessor and supports all the latest features in different versions of MS Excel. Aspose.Cells supports hide/show worksheet, tabs, rows, columns, scroll bars, gridlines and row/column headers. Here is an example that shows/hides a worksheet.

// Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream("Book1.xlsx", FileMode.Open);

// Instantiating a Workbook object with opening the Excel file through the file stream
Workbook workbook = new Workbook(fstream);

int index = workbook.Worksheets.Add();

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

// Hiding the first worksheet of the Excel file
worksheet.IsVisible = false;

// Shows first worksheet of the Excel file
//Worksheet.IsVisible = true;

// Saving the modified Excel file in default XLSX format
workbook.Save("Output.xlsx");

// Closing the file stream to free all resources
fstream.Close();

Here is the program output file where Worksheet “Sheet1” is hidden whereas the second sheet “Sheet2” is visible.
The following articles contain more information about these features:
Show and Hide Worksheets and Tabs
Show and Hide Rows Columns and Scroll Bars
Show and Hide Gridlines and Row Column Headers

The free trial version of this new product can be downloaded here:
Aspose.Cells for .NET (Latest Version)

A detailed solution is available here which can be used for testing different features of this product.