GemBox.Spreadsheet
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    ProtectedRangeCollection Class

    Namespace:
    GemBox.Spreadsheet
    Assembly:
    GemBox.Spreadsheet.dll

    Represents a collection of all protected ranges on the ExcelWorksheet.

    • C#
    • VB.NET
    public sealed class ProtectedRangeCollection : IEnumerable<ProtectedRange>, IEnumerable
    Public NotInheritable Class ProtectedRangeCollection
        Implements IEnumerable(Of ProtectedRange), IEnumerable
    Inheritance:
    System.Object
    ProtectedRangeCollection
    Implements
    System.Collections.Generic.IEnumerable<ProtectedRange>
    System.Collections.IEnumerable

    Properties

    Count

    Gets the number of ProtectedRanges actually contained in the ProtectedRangeCollection.

    • C#
    • VB.NET
    public int Count { get; }
    Public ReadOnly Property Count As Integer
    Property Value
    System.Int32

    The number of ProtectedRanges actually contained in the ProtectedRangeCollection.

    Item[Int32]

    Gets the ProtectedRange at the specified index.

    • C#
    • VB.NET
    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
    ProtectedRange

    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.

    • C#
    • VB.NET
    public ProtectedRange this[string title] { get; }
    Public ReadOnly Property Item(title As String) As ProtectedRange
    Parameters
    title
    System.String

    The ProtectedRange title.

    Property Value
    ProtectedRange

    The ProtectedRange with the specified title or null.

    Methods

    AddNew(String, String)

    Adds the new ProtectedRange to the current ExcelWorksheet.

    • C#
    • VB.NET
    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
    ProtectedRange

    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.

    • C#
    • VB.NET
    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
    ProtectedRange

    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.

    • C#
    • VB.NET
    public void Clear()
    Public Sub Clear

    GetEnumerator()

    Returns an enumerator that iterates through the ProtectedRangeCollection.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    public void RemoveAt(int index)
    Public Sub RemoveAt(index As Integer)
    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.

    Implements

    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.