Font

class Font(impl)

The font object can be accessed as an attribute of the range or shape object.

  • mysheet['A1'].font

  • mysheet.shapes[0].font

Added in version 0.23.0.

property api

返回正在使用的引擎的原生对象( pywin32appscript 对象)。

Added in version 0.23.0.

property bold

Returns or sets the bold property (boolean).

>>> sheet['A1'].font.bold = True
>>> sheet['A1'].font.bold
True

Added in version 0.23.0.

property color

Returns or sets the color property (tuple).

>>> sheet['A1'].font.color = (255, 0, 0)  # or '#ff0000'
>>> sheet['A1'].font.color
(255, 0, 0)

Added in version 0.23.0.

property italic

Returns or sets the italic property (boolean).

>>> sheet['A1'].font.italic = True
>>> sheet['A1'].font.italic
True

Added in version 0.23.0.

property name

Returns or sets the name of the font (str).

>>> sheet['A1'].font.name = 'Calibri'
>>> sheet['A1'].font.name
Calibri

Added in version 0.23.0.

property size

Returns or sets the size (float).

>>> sheet['A1'].font.size = 13
>>> sheet['A1'].font.size
13

Added in version 0.23.0.