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

    Show / Hide Table of Contents

    StyleCollection Class

    Namespace:
    GemBox.Document
    Assembly:
    GemBox.Document.dll

    Represents a collection of Styles.

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

    Used as a container for a Styles property.

    Properties

    Count

    Gets the number of Styles contained in the StyleCollection.

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

    The number of Styles contained in the StyleCollection.

    Item[Int32]

    Gets the Style at the specified index.

    • C#
    • VB.NET
    public Style this[int index] { get; }
    Public ReadOnly Property Item(index As Integer) As Style
    Parameters
    index
    System.Int32

    The zero-based index of the Style to get.

    Property Value
    Style

    The Style at the specified index.

    Item[String]

    Gets the Style with the specified style name.

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

    Name of the style.

    Property Value
    Style

    The Style with the specified style name.

    Exceptions
    System.ArgumentException

    Style with the specified name is not contained in the collection.

    Methods

    Add(Style)

    Adds a Style instance to the StyleCollection.

    • C#
    • VB.NET
    public void Add(Style item)
    Public Sub Add(item As Style)
    Parameters
    item
    Style

    The Style instance.

    Contains(Style)

    Determines whether the StyleCollection contains a specific Style instance.

    • C#
    • VB.NET
    public bool Contains(Style item)
    Public Function Contains(item As Style) As Boolean
    Parameters
    item
    Style

    The Style instance to locate in the StyleCollection.

    Returns
    System.Boolean

    true if item is found in the StyleCollection; otherwise, false.

    Contains(String)

    Determines whether the StyleCollection contains a Style instance with specific name.

    • C#
    • VB.NET
    public bool Contains(string styleName)
    Public Function Contains(styleName As String) As Boolean
    Parameters
    styleName
    System.String

    Name of the Style to locate in the StyleCollection.

    Returns
    System.Boolean

    true if Style instance with specific name is found in the StyleCollection; otherwise, false.

    GetEnumerator()

    Returns an enumerator that iterates through the StyleCollection.

    • C#
    • VB.NET
    public IEnumerator<Style> GetEnumerator()
    Public Function GetEnumerator As IEnumerator(Of Style)
    Returns
    System.Collections.Generic.IEnumerator<Style>

    A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the StyleCollection.

    GetOrAdd(StyleTemplateType)

    Gets the Style that corresponds to given StyleTemplateType.

    • C#
    • VB.NET
    public Style GetOrAdd(StyleTemplateType templateType)
    Public Function GetOrAdd(templateType As StyleTemplateType) As Style
    Parameters
    templateType
    StyleTemplateType

    The StyleTemplateType instance.

    Returns
    Style

    Style that corresponds to given StyleTemplateType.

    Remarks

    Gets the Style that corresponds to given StyleTemplateType. If StyleCollection doesn't contain correspondent style, then new style will be added and returned.

    IndexOf(Style)

    Determines the index of a specific Style instance in the StyleCollection.

    • C#
    • VB.NET
    public int IndexOf(Style item)
    Public Function IndexOf(item As Style) As Integer
    Parameters
    item
    Style

    The Style instance to locate in the StyleCollection.

    Returns
    System.Int32

    The index of item if found in the collection; otherwise, -1.

    Remove(Style)

    Removes the specific Style instance from the StyleCollection.

    • C#
    • VB.NET
    public bool Remove(Style item)
    Public Function Remove(item As Style) As Boolean
    Parameters
    item
    Style

    The Style instance to remove from the StyleCollection.

    Returns
    System.Boolean

    true if the Style was found and removed from the StyleCollection; otherwise, false.

    Exceptions
    System.InvalidOperationException

    The specific Style is used by one or more document elements.

    Implements

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

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.