XlsFont module
- class XlsFont.XlsFont
Bases:
XlsObject,IFont,IOptimizedUpdate,ICloneParentRepresents a font in an Excel worksheet.
This class provides properties and methods for manipulating fonts in Excel, including font style, size, color, and other formatting options. It extends XlsObject and implements the IFont, IOptimizedUpdate, and ICloneParent interfaces.
- BeginUpdate()
Begins a series of operations that modify the font.
This method should be called before making multiple changes to the font to improve performance.
- Clone(parent: SpireObject) XlsFont
Creates a clone of this font.
- Parameters:
parent (SpireObject) – The parent object for the cloned font.
- Returns:
A new instance of the font with the same formatting.
- Return type:
- property Color: Color
Gets or sets the color of the font.
- Returns:
A Color object representing the font color.
- Return type:
Color
- CompareTo(obj: SpireObject) int
Compares the current font with another object.
- Parameters:
obj (SpireObject) – The object to compare with the current font.
- Returns:
- A value that indicates the relative order of the objects being compared.
Less than zero: This font precedes obj in the sort order. Zero: This font occurs in the same position in the sort order as obj. Greater than zero: This font follows obj in the sort order.
- Return type:
int
- EndUpdate()
Ends a series of operations that modify the font.
This method should be called after making multiple changes to the font to apply the changes and improve performance.
- property FontName: str
Gets or sets the name of the font.
- Returns:
The name of the font.
- Return type:
str
- GenerateNativeFont
Generates a native Font object from this XlsFont.
- Returns:
A native Font object with the properties of this XlsFont.
- Return type:
- property IsAutoColor: bool
Gets whether the font color is automatically determined.
- Returns:
True if the font color is automatically determined; otherwise, False.
- Return type:
bool
- property IsBold: bool
Gets or sets whether the font is bold.
- Returns:
True if the font is bold; otherwise, False.
- Return type:
bool
- property IsItalic: bool
Gets or sets whether the font is italic.
- Returns:
True if the font is italic; otherwise, False.
- Return type:
bool
- property IsStrikethrough: bool
Gets or sets whether the font has a strikethrough.
- Returns:
True if the font has a strikethrough; otherwise, False.
- Return type:
bool
- property IsSubscript: bool
Gets or sets whether the font is subscript.
- Returns:
True if the font is subscript; otherwise, False.
- Return type:
bool
- property IsSuperscript: bool
Gets or sets whether the font is superscript.
- Returns:
True if the font is superscript; otherwise, False.
- Return type:
bool
- property KnownColor: ExcelColors
Gets or sets a predefined Excel color for the font.
- Returns:
An enumeration value representing the Excel color.
- Return type:
ExcelColors
- MeasureString(strValue: str) SizeF
Measures the size of a string when drawn with this font.
- Parameters:
strValue (str) – The string to measure.
- Returns:
The size of the string in the current font.
- Return type:
SizeF
- property OColor: OColor
Gets the Office color of the font.
- Returns:
An object representing the Office color of the font.
- Return type:
- property Scheme: str
Gets or sets the font scheme.
- Returns:
The font scheme.
- Return type:
str
- SetThemeColor(type: ThemeColorType, tint: float)
Sets a theme color for the font.
- Parameters:
type (ThemeColorType) – The theme color type to set.
tint (float) – The tint value to apply to the theme color.
- property Size: float
Gets or sets the size of the font in points.
- Returns:
The size of the font in points.
- Return type:
float
- property StrikethroughType: str
Gets or sets the type of strikethrough for the font.
- Returns:
The type of strikethrough for the font.
- Return type:
str
- property Underline: FontUnderlineType
Gets or sets the type of underline for the font.
- Returns:
An enumeration value representing the underline type.
- Return type:
FontUnderlineType
- property VerticalAlignment: FontVertialAlignmentType
Gets or sets the vertical alignment of the font.
- Returns:
An enumeration value representing the vertical alignment type.
- Return type:
FontVertialAlignmentType
