[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IStyleCollection

IStyleCollection Interface

Represents a collection of all the IStyle objects in a specified workbook or the active workbook.

This collection stores the workbook's built-in and custom named styles and provides access to them by name or index. Obtain this collection through Styles.

Namespace: GrapeCity.Documents.Excel
Assembly: DS.Documents.Excel.dll
Syntax
public interface IStyleCollection : IEnumerable<IStyle>, IEnumerable
Public Interface IStyleCollection
    Inherits IEnumerable(Of IStyle), IEnumerable
Examples
IStyleCollection styles = workbook.Styles;
IStyle normalStyle = styles["Normal"];
IStyle customStyle = styles.Add("MyStyle");
worksheet.Range["A1"].Style = customStyle;

Properties

Name Description
Count

Gets the number of IStyle objects in the collection.

This count includes the named styles available in the workbook, such as built-in styles and any custom styles added to the collection.

this[int]

Gets the IStyle object at the specified index from this collection.

Use this property to retrieve a built-in or custom named style from the workbook style collection by index.

this[string]

Gets the IStyle object with the specified name from this collection.

Use this property to retrieve a workbook style by its name from the current IStyleCollection.

Methods

Name Description
Add(string, IRange)

Creates a new IStyle and adds it to the list of styles that are available for the current Workbook.

The new style is based on the style of the specified range. Specify null to base the new style on the Normal style.

Add(string, IStyle)

Creates a new IStyle and adds it to the list of styles that are available for the current Workbook.

The new style is created by using an existing IStyle as its basis.

Contains(string)

Determines whether the style name is contained in IStyleCollection.

Use this method to check whether a built-in or custom named style is available in the workbook style collection returned by Styles.