openpyxl.styles.named_styles module

class openpyxl.styles.named_styles.NamedStyle(name='Normal', font=None, fill=None, border=None, alignment=None, number_format=None, protection=None, builtinId=None, hidden=False, xfId=None)[source]

Bases: openpyxl.descriptors.serialisable.Serialisable

Named and editable styles

alignment

Values must be of type <class ‘openpyxl.styles.alignment.Alignment’>

as_name()[source]

Return relevant named style

as_tuple()[source]

Return a style array representing the current style

as_xf()[source]

Return equivalent XfStyle

bind(wb)[source]

Bind a named style to a workbook

border

Values must be of type <class ‘openpyxl.styles.borders.Border’>

builtinId

Values must be of type <class ‘int’>

fill

Values must be of type <class ‘openpyxl.styles.fills.Fill’>

font

Values must be of type <class ‘openpyxl.styles.fonts.Font’>

hidden

Values must be of type <class ‘bool’>

name

Values must be of type <class ‘str’>

number_format

Values must be of type <class ‘str’>

protection

Values must be of type <class ‘openpyxl.styles.protection.Protection’>

xfId

Index of the style in the list of named styles

class openpyxl.styles.named_styles.NamedStyleList[source]

Bases: list

Named styles are editable and can be applied to multiple objects

As only the index is stored in referencing objects the order mus be preserved.

append(style)[source]

Append object to the end of the list.

names