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

New in version 0.23.0.

property api#

Returns the native object (pywin32 or appscript obj) of the engine being used.

New in version 0.23.0.

property bold#

Returns or sets the bold property (boolean).

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

New 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)

New in version 0.23.0.

property italic#

Returns or sets the italic property (boolean).

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

New 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

New in version 0.23.0.

property size#

Returns or sets the size (float).

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

New in version 0.23.0.