Class representing a user-protected range.
Name | Description |
AddUser | Sets a user to the current protected range. |
DeleteUser | Removes a user from the current protected range. |
GetAllUsers | Returns all users from the current protected range. |
GetUser | Returns an object that represents a user from the current protected range. |
SetAnyoneType | Sets the type of the "Anyone" user to the current protected range. |
SetRange | Sets a range to the current protected range. |
SetTitle | Sets a title to the current protected range. |
builder.CreateFile("xlsx"); var oWorksheet = Api.GetActiveSheet(); oWorksheet.GetRange("A1").SetValue("1"); oWorksheet.GetRange("B1").SetValue("2"); oWorksheet.GetRange("C1").SetValue("3"); oWorksheet.AddProtectedRange("Protected range", "A1:C1"); var oProtectedRange = oWorksheet.GetProtectedRange("Protected range"); oProtectedRange.AddUser("uid-1", "John Smith", "CanEdit"); oProtectedRange.AddUser("uid-2", "Mark Potato", "CanView"); var oUser = oProtectedRange.GetUser("uid-1"); oWorksheet.GetRange("A3").SetValue("User 1 name: " + oUser.GetName()); var aUsers = oProtectedRange.GetAllUsers(); oWorksheet.GetRange("A4").SetValue("User 2 name: " + aUsers[1].GetName()); oProtectedRange.DeleteUser("uid-2"); oProtectedRange.SetAnyoneType("CanView"); oProtectedRange.SetTitle("New protected range"); oProtectedRange.SetRange("B1:C1"); builder.SaveFile("xlsx", "ApiProtectedRange.xlsx"); builder.CloseFile();