Message-ID: <2090036951.8307.1711641268302.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8306_998032803.1711641268302" ------=_Part_8306_998032803.1711641268302 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html SheetProtection

SheetProtection

Introduced in build 8.6.1

=20

Description

=20

A SheetProtection object contains sheet level protection pr= operties that control what users can interact with when a worksheet is prot= ected. To access SheetProtection, use Worksheet.SheetProtection.

=20
C#
=20
 public sealed class SheetProtection
=20
=20
vb.net
=20
Public NotInheritable Class SheetProtection
=20
=20

Remarks

=20

In a new workbook, AllowSelectLockedCells and AllowS= electUnlockedCells default to true. The rest of the proper= ties default to false.

=20

The SheetProtection properties will only take effect if the= worksheet is protected. Worksheets can be protected with Worksheet.Protect(Strin= g). If the worksheet is not protected, the values of the properties wil= l persist, but will not have an effect.

=20

Examples

=20
C#
=20

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

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

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

        
=20
=20
vb.net
=20

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

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

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

        
=20
=20

Properties

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20

Name

Description

AllowSelectLockedCells

Sets or returns whether the worksheet will allo= w users to select locked cells when the worksheet is protected.

AllowSelectUnlockedCells

Sets or returns whether the worksheet will allo= w users to select unlocked cells when the worksheet is protected.

AllowFormatCells

Sets or returns whether the worksheet will allo= w users to format cells when the worksheet is protected.

AllowFormatRows

Sets or returns whether the worksheet will allo= w users to format rows when the worksheet is protected.

AllowFormatColumns

Sets or returns whether the worksheet will allo= w users to format columns when the worksheet is protected.

AllowInsertColumns

Sets or returns whether the worksheet will allo= w users to insert columns when the worksheet is protected.

AllowInsertRows

Sets or returns whether the worksheet will allo= w users to insert rows when the worksheet is protected.

AllowInsertHyperlinks

Sets or returns whether the worksheet will allo= w users to insert hyperlinks when the worksheet is protected.

AllowDeleteColumns

Sets or returns whether the worksheet will allo= w users to delete columns when the worksheet is protected.

AllowDeleteRows

Sets or returns whether the worksheet will allo= w users to delete rows when the worksheet is protected.

AllowSort

Sets or returns whether the worksheet will allo= w users to sort when the worksheet is protected.

AllowUseAutoFilter

Sets or returns whether the worksheet will allo= w users to use AutoFilters when the worksheet is protected.

AllowUsePivotTableReports

Sets or returns whether the worksheet will allo= w users to use PivotTable reports when the worksheet is protected.
------=_Part_8306_998032803.1711641268302--