Font
- class Font(impl)
The font object can be accessed as an attribute of the range or shape object.
mysheet['A1'].fontmysheet.shapes[0].font
在 0.23.0 版本加入.
- property api: Any
Returns the native object (
pywin32orappscriptobj) of the engine being used.在 0.23.0 版本加入.
- property bold: bool | None
Returns or sets the bold property (boolean).
>>> sheet['A1'].font.bold = True >>> sheet['A1'].font.bold True
在 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)
在 0.23.0 版本加入.
- async get_bold()
Fetch the bold property on demand.
Noneif the range's cells don't all agree.Requires xlwings Lite.
- async get_color()
Fetch the font colour on demand, as an RGB tuple.
Noneif unset or if the range's cells don't all agree.Requires xlwings Lite.
- async get_italic()
Fetch the italic property on demand.
Noneif the range's cells don't all agree.Requires xlwings Lite.
- async get_name()
Fetch the font name on demand.
Noneif the range's cells don't all agree.Requires xlwings Lite.
- async get_size()
Fetch the font size on demand.
Noneif the range's cells don't all agree.Requires xlwings Lite.
- property italic: bool | None
Returns or sets the italic property (boolean).
>>> sheet['A1'].font.italic = True >>> sheet['A1'].font.italic True
在 0.23.0 版本加入.