Font
- class Font
The font object can be accessed as an attribute of the range or shape object.
mysheet['A1'].fontmysheet.shapes[0].font
Added in version 0.23.0.
- property api: Any
Returns the native object (
pywin32orappscriptobj) of the engine being used.Added in version 0.23.0.
- property bold: bool | None
Returns or sets the bold property (boolean).
>>> sheet['A1'].font.bold = True >>> sheet['A1'].font.bold True
- Setter type:
bool
Added in version 0.23.0.
- property color: tuple[int, int, int] | None
Returns or sets the color property (tuple).
>>> sheet['A1'].font.color = (255, 0, 0) # or '#ff0000' >>> sheet['A1'].font.color (255, 0, 0)
- Setter type:
tuple[int, int, int] | str
Added in version 0.23.0.
- async get_bold()
Fetch the bold property on demand.
Noneif the range’s cells don’t all agree.Requires xlwings Lite.
- Return type:
bool | None
- async get_color()
Fetch the font color on demand, as an RGB tuple.
Noneif unset or if the range’s cells don’t all agree.Requires xlwings Lite.
- Return type:
tuple[int, int, int] | None
- async get_italic()
Fetch the italic property on demand.
Noneif the range’s cells don’t all agree.Requires xlwings Lite.
- Return type:
bool | None
- async get_name()
Fetch the font name on demand.
Noneif the range’s cells don’t all agree.Requires xlwings Lite.
- Return type:
str | None
- async get_size()
Fetch the font size on demand.
Noneif the range’s cells don’t all agree.Requires xlwings Lite.
- Return type:
float | None
- property italic: bool | None
Returns or sets the italic property (boolean).
>>> sheet['A1'].font.italic = True >>> sheet['A1'].font.italic True
- Setter type:
bool
Added in version 0.23.0.