StyleCollection module

class StyleCollection.StyleCollection

Bases: DocumentSerializableCollection, IStyleCollection

Represents a collection of styles.

Add(style: IStyle) int

Adds a style to the collection.

Parameters:

style – The style to add.

Returns:

The index of the added style.

ApplyDocDefaultsToNormalStyle()

Applies the document default paragraph format and character format to the normal style.

FindById(styleId: int) IStyle

Finds a style by id.

Parameters:

styleId – The id of the style.

Returns:

The style with the specified id.

FindByIdentifier(sIdentifier: int) IStyle

Finds a style by identifier.

Parameters:

sIdentifier – The style identifier. The parameter value is the Spire.Doc.Documents.BuiltinStyle enumeration value or the Spire.Doc.Documents.DefaultTableStyle enumeration value.

Returns:

The style with the specified identifier.

FindByIstd(istd: int) IStyle

Finds a style by istd.

Parameters:

istd – The istd of the style.

Returns:

The style with the specified istd.

FindByName

Finds a style by name.

Parameters:

name – The name of the style.

Returns:

The style with the specified name.

get_Item(index: int) IStyle

Gets the style at the specified index.

Parameters:

index – The index of the style.

Returns:

The style at the specified index.