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
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.
public sealed class SheetProtection=20
Public NotInheritable Class SheetProtection=20
In a new workbook, AllowSelectLockedCells and AllowS=
electUnlockedCells default to true
. The rest of the proper=
ties default to false
.
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.
//--- 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
'--- 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
Name | =20
Description | =20
---|---|
=20 | Sets or returns whether the worksheet will allo= w users to select locked cells when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to select unlocked cells when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to format cells when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to format rows when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to format columns when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to insert columns when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to insert rows when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to insert hyperlinks when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to delete columns when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to delete rows when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to sort when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to use AutoFilters when the worksheet is protected. | =20
=20 | Sets or returns whether the worksheet will allo= w users to use PivotTable reports when the worksheet is protected. | =20