If you have more than one sheet in the component, you can hide a sheet so that it is not displayed to the user. Even though it is not displayed, it is not removed from the component. There must be at least one sheet in the component. For information on adding a sheet, refer to Adding a Sheet.
Hiding a sheet does not change the default sheet names provided for the other sheets. For example, a Spread component with three sheets would by default name them Sheet1, Sheet2, and Sheet3. If you hide the second sheet, the names for the remaining sheets are Sheet1 and Sheet3.
Hiding a sheet does not remove it and does not affect formulas on that sheet or references to that sheet.
Set the Sheets shortcut object Visible property for the sheet.
This example code hides the second and fourth sheets in a Spread component that has eight sheets.
C# |
Copy Code
|
---|---|
private void Form1_Load(object sender, System.EventArgs e) { // Set the Spread to have eight sheets. fpSpread1.Sheets.Count = 8; // Hide the second and fourth sheets. fpSpread1.Sheets[1].Visible = false; fpSpread1.Sheets[3].Visible = false; } |
VB |
Copy Code
|
---|---|
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Set the Spread to have eight sheets. fpSpread1.Sheets.Count = 8 ' Hide the second and fourth sheets. fpSpread1.Sheets(1).Visible = False fpSpread1.Sheets(3).Visible = False End Sub |
You can hide a sheet by using the tab strip's context menu and choosing 'Hide' option. The tab strip context menu can be enabled by setting the Editable option as true.
C# |
Copy Code
|
---|---|
fpSpread1.TabStrip.Editable = true;
|
Similarly, you can select 'Unhide' from tab strip context menu to unhide sheets. The 'Unhide' dialog listing all the hidden sheets is opened from which you can select the ones you want to unhide.
You can choose 'Hide' and 'Unhide' options from tab strip context menu in Spread Designer as well. However, these options can be disabled by checking the “Show hidden sheets” option in 'Preferences' dropdown list (unchecked by default). This will ensure that the hidden sheets are always shown.