Back to Devexpress

Worksheet.VisibilityType Property

officefileapi-devexpress-dot-spreadsheet-dot-worksheet-449d9df8.md

latest8.1 KB
Original Source

Worksheet.VisibilityType Property

Gets or sets whether the current worksheet is visible, hidden or “very hidden”.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
WorksheetVisibilityType VisibilityType { get; set; }
vb
Property VisibilityType As WorksheetVisibilityType

Property Value

TypeDescription
WorksheetVisibilityType

A WorksheetVisibilityType enumeration member that specifies the worksheet visibility type.

|

Available values:

NameDescription
Visible

A worksheet is visible.

| | Hidden |

A worksheet is hidden.

| | VeryHidden |

A worksheet is hidden and cannot be unhidden via the user interface.

|

Remarks

Set the VisibilityType property to WorksheetVisibilityType.Hidden to hide the worksheet. Set it to WorksheetVisibilityType.Visible to show the previously hidden worksheet again. You can also accomplish this via the Worksheet.Visible property.

Also, the VisibilityType property provides you with the capability to make the worksheet “very hidden” (WorksheetVisibilityType.VeryHidden). This is a specific mode that does not allow the worksheet to be shown again by end-users. To make a “very hidden” worksheet visible again, set the VisibilityType property to WorksheetVisibilityType.Visible or Worksheet.Visible to true.

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.

Example

This example demonstrates how to manage worksheet visibility in a workbook. To do this, use the following properties.

Note

A workbook must always contain at least one visible worksheet.

View Example

csharp
// 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;
vb
' 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

The following code snippets (auto-collected from DevExpress Examples) contain references to the VisibilityType property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-spreadsheetcontrol-api-part1/CS/SpreadsheetControl/SpreadsheetActions/WorksheetActions.cs#L102

csharp
// To make this worksheet visible again, use the Worksheet.Visible property.
workbook.Worksheets["Sheet2"].VisibilityType = WorksheetVisibilityType.VeryHidden;

wpf-spreadsheetcontrol-api-part-1/CS/SpreadsheetControl_WPF_API/SpreadsheetActions/WorksheetActions.cs#L119

csharp
// To make this worksheet visible again, use the Worksheet.Visible property.
workbook.Worksheets["Sheet2"].VisibilityType = WorksheetVisibilityType.VeryHidden;

spreadsheet-document-api-examples-part1/CS/SpreadsheetExamples/SpreadsheetActions/WorksheetActions.cs#L113

csharp
// Use the Worksheet.Visible property to unhide this worksheet.
workbook.Worksheets["Sheet2"].VisibilityType = WorksheetVisibilityType.VeryHidden;

winforms-spreadsheetcontrol-api-part1/VB/SpreadsheetControl/SpreadsheetActions/WorksheetActions.vb#L104

vb
' To make this worksheet visible again, use the Worksheet.Visible property.
workbook.Worksheets("Sheet2").VisibilityType = WorksheetVisibilityType.VeryHidden

wpf-spreadsheetcontrol-api-part-1/VB/SpreadsheetControl_WPF_API/SpreadsheetActions/WorksheetActions.vb#L108

vb
' To make this worksheet visible again, use the Worksheet.Visible property.
workbook.Worksheets("Sheet2").VisibilityType = WorksheetVisibilityType.VeryHidden

spreadsheet-document-api-examples-part1/VB/SpreadsheetExamples/SpreadsheetActions/WorksheetActions.vb#L111

vb
' Use the Worksheet.Visible property to unhide this worksheet.
workbook.Worksheets("Sheet2").VisibilityType = WorksheetVisibilityType.VeryHidden
' Hide the "Sheet3" worksheet.

See Also

Visible

How to: Access a Worksheet

How to: Add a New Worksheet

How to: Delete a Worksheet

Worksheets in Spreadsheet Documents

Worksheet Interface

Worksheet Members

DevExpress.Spreadsheet Namespace