Sheets Visibility
The purpose of this article is to describe what is Sheets Visibility. It contains the following sections:
What is Sheets Visibility?
Sheets Visibility is a mechanism to change the visibility of certain sheet, in order to be able to show and hide the relevant sheet(s);
Hiding Sheets
There are two available options when hiding sheets. The first option is by setting the sheet Visibility property exposed both by the SheetCollection and WorksheetCollection classes. This property is of type SheetVisibility, an enum describing the types of visibility of the sheets:
- Visible: Visible sheet visibility.
- Hidden: Hidden sheet visibility.
-
VeryHidden: Very hidden sheet visibility.
The VeryHidden can be set only from the provided API, while the Hidden state is designed for UI purposes.
Example 1: Setting the SheetVisibility to Hidden/VeryHidden
- a sheet at the specified index;
- a specified sheet;
- an active sheet. (available on SheetCollection only)
Example 2: Hiding sheets using the Hide method
Unhiding Sheets
As with hiding, unhiding can be done both through setting the Sheet Visibility property, or by using the Unhide method exposed by the SheetCollection and WorksheetCollection classes.
The following code snippets exemplify the two approaches.
Example 3: Setting the SheetVisibility to Visible
- a sheet at the specified index.
- a specified sheet.