Class ProtectedRangeCollection
Represents a collection of protected ranges in a worksheet.
Inherited Members
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class ProtectedRangeCollection : ICollection<ProtectedRange>, IEnumerable<ProtectedRange>, IEnumerable
Constructors
ProtectedRangeCollection()
Represents a collection of protected ranges in a worksheet.
Declaration
public ProtectedRangeCollection()
Properties
Count
Gets the number of protected ranges in the collection.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
IsReadOnly
Gets a value indicating whether the collection is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| bool |
this[int]
Gets the protected range at the specified index.
Declaration
public ProtectedRange this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index of the protected range. |
Property Value
| Type | Description |
|---|---|
| ProtectedRange |
Methods
Add(ProtectedRange)
Adds a ProtectedRange object to the collection (internal use for converters).
Declaration
public void Add(ProtectedRange protectedRange)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedRange | protectedRange |
Add(string, int, int, int, int)
Adds a new protected range with the specified name and cell coordinates.
Declaration
public int Add(string name, int firstRow, int firstColumn, int lastRow, int lastColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the protected range. |
| int | firstRow | The first row index (0-based). |
| int | firstColumn | The first column index (0-based). |
| int | lastRow | The last row index (0-based). |
| int | lastColumn | The last column index (0-based). |
Returns
| Type | Description |
|---|---|
| int | The index of the newly added protected range. |
Add(string, string)
Adds a new protected range with the specified name and range address.
Declaration
public int Add(string name, string range)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the protected range. |
| string | range | The range address in A1-style notation (e.g., "A1:C3"). |
Returns
| Type | Description |
|---|---|
| int | The index of the newly added protected range. |
Clear()
Removes all protected ranges from the collection.
Declaration
public void Clear()
Contains(ProtectedRange)
Determines whether the collection contains the specified protected range.
Declaration
public bool Contains(ProtectedRange item)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedRange | item |
Returns
| Type | Description |
|---|---|
| bool |
CopyTo(ProtectedRange[], int)
Copies the protected ranges to an array.
Declaration
public void CopyTo(ProtectedRange[] array, int arrayIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedRange[] | array | |
| int | arrayIndex |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<ProtectedRange> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<ProtectedRange> |
Remove(ProtectedRange)
Removes the specified protected range from the collection.
Declaration
public bool Remove(ProtectedRange item)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedRange | item |
Returns
| Type | Description |
|---|---|
| bool |
RemoveAt(int)
Removes the protected range at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index of the protected range to remove. |