Worksheet.Visible Property
Gets or sets whether the current worksheet is visible or hidden.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v20.2.Core.dll
Declaration
Property Value
Type | Description |
---|---|
Boolean | true, if the worksheet is visible; otherwise, false. |
Remarks
Use the Visible property to control the visibility of the worksheet. To hide and unhide a worksheet, you can also use the Worksheet.VisibilityType property. It allows you to mark a worksheet as "very hidden". In this mode, the worksheet cannot be accessed by end-users.
If you hide a worksheet that is currently active, the next visible worksheet to the right of this worksheet is automatically activated. If there are no visible worksheets to the right of the hidden worksheet, the first visible worksheet to the left of this worksheet becomes active.
NOTE
A workbook must always contain at least one visible worksheet.
Examples
This example demonstrates how to manage worksheet visibility in a workbook. To do this, use the following properties.
-
Set this property to false to hide a worksheet. To make a worksheet visible again, you can set the Visible property to true or the Worksheet.VisibilityType property to the WorksheetVisibilityType.Visible enumeration member. End-users can show a hidden worksheet via the user interface (for example, when opening a workbook in Microsoft® Excel® or SpreadsheetControl).
-
Setting this property to WorksheetVisibilityType.Hidden is equivalent to setting the Worksheet.Visible property to false - the hidden worksheet can be shown again by end-users via the user interface (for example, Microsoft® Excel® or SpreadsheetControl).
The VisibilityType property also allows you to hide a worksheet so that it becomes impossible for end-users to access this worksheet. To do this, mark a worksheet as "very hidden" by setting the VisibilityType property to WorksheetVisibilityType.VeryHidden. To show a worksheet again, set the Visible property to true or VisibilityType to WorksheetVisibilityType.Visible.
NOTE
A workbook must always contain at least one visible worksheet.
NOTE
A complete sample project is available at https://github.com/DevExpress-Examples/spreadsheet-document-server-api-e4339
// Hide the worksheet under the "Sheet2" name and prevent end-users from unhiding it via user interface.
// To make this worksheet visible again, use the Worksheet.Visible property.
workbook.Worksheets["Sheet2"].VisibilityType = WorksheetVisibilityType.VeryHidden;
// Hide the "Sheet3" worksheet.
// In this state a worksheet can be unhidden via user interface.
workbook.Worksheets["Sheet3"].Visible = false;