StyleArrayWrapper module

class StyleArrayWrapper.StyleArrayWrapper

Bases: XlsObject, IStyle, IExtendIndex

Represents a wrapper for cell style arrays in Excel.

This class implements the IStyle and IExtendIndex interfaces and provides functionality for managing cell formatting styles including borders, fill patterns, fonts, alignment, number formats, and protection settings. It allows batch updates to style properties through BeginUpdate and EndUpdate methods.

BeginUpdate()

Begins a batch update operation on the style.

This method marks the start of a series of changes to the style properties. For better performance, multiple property changes should be made between BeginUpdate and EndUpdate calls.

property Borders: IBorders

Gets the borders collection for the style.

Returns:

The collection of borders for the style.

Return type:

IBorders

property BuiltIn: bool

Gets whether the style is a built-in style.

Returns:

True if the style is a built-in style; otherwise, False.

Return type:

bool

property Color: Color

Gets or sets the cell color for the style.

Returns:

The cell color object.

Return type:

Color

EndUpdate()

Ends a batch update operation on the style.

This method applies all pending changes to the style properties that were made since the last BeginUpdate call.

property ExtendedFormatIndex: int

Gets the extended format index for the style.

Returns:

The extended format index.

Return type:

int

property FillBackground: ExcelColors

Gets or sets the background color for the fill pattern.

Returns:

The background color as an Excel color.

Return type:

ExcelColors

property FillBackgroundRGB: Color
property FillForeground: ExcelColors
property FillForegroundRGB: Color
property FillPattern: ExcelPatternType

Gets or sets the fill pattern type for the style.

Returns:

The fill pattern type.

Return type:

ExcelPatternType

property Font: IFont

Gets the font object for the style.

Returns:

The font object.

Return type:

IFont

property FormulaHidden: bool

Gets or sets whether formulas are hidden when the worksheet is protected.

Returns:

True if formulas are hidden; otherwise, False.

Return type:

bool

property HorizontalAlignment: HorizontalAlignType

Gets or sets the horizontal alignment for the style.

Returns:

The horizontal alignment type.

Return type:

HorizontalAlignType

property IncludeAlignment: bool

Gets or sets whether alignment settings are included in the style.

Returns:

True if alignment settings are included; otherwise, False.

Return type:

bool

property IncludeBorder: bool

Gets or sets whether border settings are included in the style.

Returns:

True if border settings are included; otherwise, False.

Return type:

bool

property IncludeFont: bool

Gets or sets whether font settings are included in the style.

Returns:

True if font settings are included; otherwise, False.

Return type:

bool

property IncludeNumberFormat: bool

Gets or sets whether number format settings are included in the style.

Returns:

True if number format settings are included; otherwise, False.

Return type:

bool

property IncludePatterns: bool

Gets or sets whether pattern settings are included in the style.

Returns:

True if pattern settings are included; otherwise, False.

Return type:

bool

property IncludeProtection: bool

Gets or sets whether protection settings are included in the style.

Returns:

True if protection settings are included; otherwise, False.

Return type:

bool

property IndentLevel: int

Gets or sets the indent level for the style.

Returns:

The indent level value.

Return type:

int

property Interior: IInterior

Gets the interior object for the style.

The interior object contains properties for formatting the inside of a cell or range.

Returns:

The interior object.

Return type:

IInterior

property IsFirstSymbolApostrophe: bool

Gets or sets whether the first character in the cell is an apostrophe.

In Excel, an apostrophe at the beginning of a cell’s text forces the cell to be treated as text, even if it contains what would otherwise be interpreted as a number or formula.

Returns:

True if the first character is an apostrophe; otherwise, False.

Return type:

bool

property IsInitialized: bool

Gets whether the style has been initialized.

Returns:

True if the style has been initialized; otherwise, False.

Return type:

bool

property IsModified: bool

Gets whether the style has been modified since it was created or last saved.

Returns:

True if the style has been modified; otherwise, False.

Return type:

bool

property JustifyLast: bool

Gets or sets whether the last line of text is justified.

Returns:

True if the last line is justified; otherwise, False.

Return type:

bool

property KnownColor: ExcelColors

Gets or sets the cell color using Excel’s predefined color palette.

Returns:

The cell color from Excel’s color palette.

Return type:

ExcelColors

property Locked: bool

Gets or sets whether the cells using this style are locked.

When a worksheet is protected, locked cells cannot be modified by the user.

Returns:

True if cells are locked; otherwise, False.

Return type:

bool

property Name: str

Gets the name of the style.

Returns:

The name of the style.

Return type:

str

property NumberFormat: str

Gets or sets the number format string for the style.

The format string follows Excel’s number format syntax.

Returns:

The number format string.

Return type:

str

property NumberFormatIndex: int

Gets or sets the index of the number format.

Returns:

The index of the number format.

Return type:

int

property NumberFormatLocal: str

Gets or sets the number format string in the user’s local language.

Returns:

The localized number format string.

Return type:

str

property NumberFormatSettings: INumberFormat

Gets the number format settings object for the style.

Returns:

The number format settings object.

Return type:

INumberFormat

property PatternColor: Color

Gets or sets the pattern color for the style.

Returns:

The pattern color object.

Return type:

Color

property PatternKnownColor: ExcelColors

Gets or sets the pattern color using Excel’s predefined color palette.

Returns:

The pattern color from Excel’s color palette.

Return type:

ExcelColors

property ReadingOrder: ReadingOrderType

Gets or sets the reading order for the style.

Returns:

The reading order type (left-to-right, right-to-left, or context).

Return type:

ReadingOrderType

property Rotation: int

Gets or sets the text rotation angle for the style.

Returns:

The text rotation angle in degrees.

Return type:

int

SetThemeColor(type: ThemeColorType, tint: float)

Sets a theme color for the style.

Parameters:
  • type (ThemeColorType) – The theme color type.

  • tint (float) – The tint value to apply to the theme color (-1.0 to 1.0).

property ShrinkToFit: bool

Gets or sets whether text automatically shrinks to fit in the available column width.

Returns:

True if text shrinks to fit; otherwise, False.

Return type:

bool

property VerticalAlignment: VerticalAlignType

Gets or sets the vertical alignment for the style.

Returns:

The vertical alignment type.

Return type:

VerticalAlignType

property WrapText: bool

Gets or sets whether text is wrapped within the cell.

Returns:

True if text wrapping is enabled; otherwise, False.

Return type:

bool