Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Description

Excerpt

A SheetProtection object contains sheet level protection properties.

Signature
C#
C#
 public sealed class SheetProtection
Signature
vb.net
vb.net
Public NotInheritable Class SheetProtection
Remarks

Example
Code Block
csharp
csharp
titleC#

          //--- Open existing spreadsheet
          ExcelApplication xla = new ExcelApplication();
          Workbook wb = xla.Open(@"C:\MySpreadsheet.xls");

          //--- Get SheetProtection
          SheetProtection protection = wb[0].SheetProtection;

          //--- Set Properties
          protection.AllowFormatCells = true;
          protection.AllowSort = false;

        
Code Block
vbnet
vbnet
titlevb.net

          '--- Open existing spreadsheet
          Dim xla As New ExcelApplication()
          Dim wb As Workbook = xla.Open("C:\MySpreadsheet")

          '--- Get SheetProtection
          Dim protection As SheetProtection = wb(0).SheetProtection

          '--- Set Properties
          protection.AllowFormatCells = true;
          protection.AllowSort = false;

        
Properties

Name

Description

AllowSelectLockedCells

Excerpt Include
EW8:SheetProtection.AllowSelectLockedCells
EW8:SheetProtection.AllowSelectLockedCells
nopaneltrue