Other API Samples

Live SpreadsheetGear API Samples

Worksheet Samples Sheet Visibility

Sheets can be made visible to the end-user, and can be either "hidden" or "very hidden" as described in this sample.

// Create a new workbook with 3 sheets.
SpreadsheetGear.IWorkbookSet workbookSet = SpreadsheetGear.Factory.GetWorkbookSet();
workbookSet.SheetsInNewWorkbook = 3;
SpreadsheetGear.IWorkbook workbook = workbookSet.Workbooks.Add();

// A Hidden state will exclude this sheet from the tab bar, but will still make this entry visible in Excel's "Unhide Sheet..." dialog and SpreadsheetGear's WorkbookExplorer, giving the end-user a change to unhide it.
workbook.Worksheets["Sheet1"].Visible = SpreadsheetGear.SheetVisibility.Hidden;

// A VeryHidden state excludes the sheet from both the tab bar and Excel and SpreadsheetGear's dialogs, effectively making it impossible for an end-user to unhide the sheet on their own (except in Excel where an experienced user could use VBA to unhide the sheet).
workbook.Worksheets["Sheet2"].Visible = SpreadsheetGear.SheetVisibility.VeryHidden;
Run This Sample
Download File

Download an Excel Open XML Workbook (*.xlsx) file with the results of this sample.