FontArrayWrapper module

class FontArrayWrapper.FontArrayWrapper

Bases: XlsObject, IFont, IOptimizedUpdate

Represents a wrapper for font arrays in Excel.

This class provides access to font properties for multiple cells or ranges, allowing batch operations on font attributes such as style, color, size, etc. It implements the IFont interface for font manipulation and IOptimizedUpdate for performance optimization when making multiple changes.

BeginUpdate()

Begins a batch update operation on the font properties.

This method should be called before making multiple changes to font properties to improve performance by deferring the actual updates until EndUpdate is called.

property Color: Color

Gets the color of the font.

Returns:

A Color object representing the font color.

Return type:

Color

EndUpdate()

Ends a batch update operation and applies all pending changes to font properties.

This method should be called after BeginUpdate to apply all the changes made to font properties in a single operation, improving performance.

property FontName: str

Gets the name of the font.

Returns:

The name of the font.

Return type:

str

GenerateNativeFont() Font

Generates a native Font object from this FontArrayWrapper.

Returns:

A Font object representing the font settings in this wrapper.

Return type:

Font

property IsAutoColor: bool

Gets a value indicating whether the font color is set to automatic.

Returns:

True if the font color is automatic; otherwise, False.

Return type:

bool

property IsBold: bool

Gets a value indicating whether the font is bold.

Returns:

True if the font is bold; otherwise, False.

Return type:

bool

property IsItalic: bool

Gets a value indicating whether the font is italic.

Returns:

True if the font is italic; otherwise, False.

Return type:

bool

property IsStrikethrough: bool

Gets a value indicating whether the font has a strikethrough.

Returns:

True if the font has a strikethrough; otherwise, False.

Return type:

bool

property IsSubscript: bool

Gets a value indicating whether the font is subscript.

Returns:

True if the font is subscript; otherwise, False.

Return type:

bool

property IsSuperscript: bool

Gets a value indicating whether the font is superscript.

Returns:

True if the font is superscript; otherwise, False.

Return type:

bool

property KnownColor: ExcelColors

Gets the predefined Excel color of the font.

Returns:

An enumeration value representing the Excel color.

Return type:

ExcelColors

SetThemeColor(type: ThemeColorType, tint: float)

Sets a theme color for the font.

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

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

property Size: float

Gets the size of the font in points.

Returns:

The font size in points.

Return type:

float

property StrikethroughType: str

Gets the type of strikethrough applied to the font.

Returns:

A string representing the type of strikethrough.

Return type:

str

property Underline: FontUnderlineType

Gets the type of underline applied to the font.

Returns:

An enumeration value representing the underline type.

Return type:

FontUnderlineType

property VerticalAlignment: FontVertialAlignmentType

Gets the vertical alignment of the font.

Returns:

An enumeration value representing the vertical alignment.

Return type:

FontVertialAlignmentType