.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

How to: Show and Hide a Worksheet

  • 2 minutes to read

You need a license to the DevExpress Office File API or DevExpress Universal Subscription to use these examples in production code. Refer to the DevExpress Subscription page for pricing information.

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


A workbook must always contain at least one visible worksheet.

// 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;

After executing the code above, the "Sheet2" worksheet is hidden, and cannot be accessed by an end-user in Microsoft® Excel®. The "Sheet3" worksheet is also hidden, but its visibility can be restored by an end-user.


See Also