ProtectedRangeCollection Class
Represents a collection of all protected ranges on the ExcelWorksheet.
public sealed class ProtectedRangeCollection : IEnumerable<ProtectedRange>, IEnumerable
Public NotInheritable Class ProtectedRangeCollection
Implements IEnumerable(Of ProtectedRange), IEnumerable
- Inheritance:
- System.ObjectProtectedRangeCollection
Properties
Count
Gets the number of ProtectedRanges actually contained in the ProtectedRangeCollection.
Property Value
- System.Int32
The number of ProtectedRanges actually contained in the ProtectedRangeCollection.
Item[Int32]
Gets the ProtectedRange at the specified index.
public ProtectedRange this[int index] { get; }
Public ReadOnly Property Item(index As Integer) As ProtectedRange
Parameters
index
- System.Int32
The zero-based index of the ProtectedRange to get.
Property Value
The ProtectedRange at the specified index.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than zero or is equal to or greater than Count.
Item[String]
Gets the ProtectedRange with the specified title or null.
public ProtectedRange this[string title] { get; }
Public ReadOnly Property Item(title As String) As ProtectedRange
Parameters
title
- System.String
The ProtectedRange title.
Property Value
The ProtectedRange with the specified title or null.
Methods
AddNew(String, String)
Adds the new ProtectedRange to the current ExcelWorksheet.
public ProtectedRange AddNew(string title, string refersToCells)
Public Function AddNew(title As String, refersToCells As String) As ProtectedRange
Parameters
title
- System.String
The ProtectedRange title.
refersToCells
- System.String
A reference to a range of cells that should be protected.
Returns
A new ProtectedRange added to the current ExcelWorksheet.
Exceptions
- System.ArgumentNullException
title
or refersToCells
is null or System.String.Empty.
AddNew(String, String, String)
Adds the new ProtectedRange to the current ExcelWorksheet.
public ProtectedRange AddNew(string title, string refersToCells, string password)
Public Function AddNew(title As String, refersToCells As String, password As String) As ProtectedRange
Parameters
title
- System.String
The ProtectedRange title.
refersToCells
- System.String
A reference to a range of cells that should be protected.
password
- System.String
The optional password.
Returns
A new ProtectedRange added to the current ExcelWorksheet.
Exceptions
- System.ArgumentNullException
title
or refersToCells
is null or System.String.Empty.
Clear()
Removes all ProtectedRanges from the current ExcelWorksheet.
GetEnumerator()
Returns an enumerator that iterates through the ProtectedRangeCollection.
public IEnumerator<ProtectedRange> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of ProtectedRange)
Returns
- System.Collections.Generic.IEnumerator<ProtectedRange>
An enumerator for the ProtectedRangeCollection.
RemoveAt(Int32)
Removes the ProtectedRange at the specified index of the ProtectedRangeCollection.
Parameters
index
- System.Int32
The zero-based index of the ProtectedRange to remove.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than zero or is equal to or greater than Count.