Class ProtectedRange

ProtectedRange class

A specified range to be allowed to edit when the sheet protection is ON.

public class ProtectedRange

Properties

NameDescription
CellArea { get; }Gets the CellArea object represents the cell area to be protected.
IsProtectedWithPassword { get; }Indicates whether the worksheets is protected with password.
Name { get; set; }Gets the Range title. This is used as a descriptor, not as a named range definition.
Password { get; set; }Represents the password to protect the range.
SecurityDescriptor { get; set; }The security descriptor defines user accounts who may edit this range without providing a password to access the range.

Methods

NameDescription
AddArea(int, int, int, int)Adds a referred area to this
GetAreas()Gets all referred areas.

Examples

// Called: ProtectedRange r = pranges[index];
[Test]
         public void Type_ProtectedRange()
         {
           
             Workbook workbook = new Workbook();
             ProtectedRangeCollection pranges = workbook.Worksheets[0].AllowEditRanges;
             int index = pranges.Add("Range1", 0, 0, 10, 10);
             ProtectedRange r = pranges[index];
            Assert.AreEqual(1, r.GetAreas().Length);
             string x = "O:WDG:WDD:(D;;CC;;;S-1-5-21-2854911246-2539335229-2923752399-1000)(A;;CC;;;S-1-5-21-2854911246-2539335229-2923752399-1013)";
             r.SecurityDescriptor = x;
             workbook.Save(Constants.destPath + "CELLSNET41052.xlsx");
             workbook = new Workbook(Constants.destPath + "CELLSNET41052.xlsx");
             Assert.AreEqual(workbook.Worksheets[0].AllowEditRanges[0].SecurityDescriptor, x);
         }

See Also