openpyxl.styles.named_styles module

class openpyxl.styles.named_styles.NamedStyle(name='Normal', font=<openpyxl.styles.fonts.Font object> Parameters: name=None, charset=None, family=None, b=False, i=False, strike=None, outline=None, shadow=None, condense=None, color=None, extend=None, sz=None, u=None, vertAlign=None, scheme=None, fill=<openpyxl.styles.fills.PatternFill object> Parameters: patternType=None, fgColor=<openpyxl.styles.colors.Color object> Parameters: rgb='00000000', indexed=None, auto=None, theme=None, tint=0.0, type='rgb', bgColor=<openpyxl.styles.colors.Color object> Parameters: rgb='00000000', indexed=None, auto=None, theme=None, tint=0.0, type='rgb', border=<openpyxl.styles.borders.Border object> Parameters: outline=True, diagonalUp=False, diagonalDown=False, start=None, end=None, left=None, right=None, top=None, bottom=None, diagonal=None, vertical=None, horizontal=None, alignment=<openpyxl.styles.alignment.Alignment object> Parameters: horizontal=None, vertical=None, textRotation=0, wrapText=None, shrinkToFit=None, indent=0.0, relativeIndent=0.0, justifyLastLine=None, readingOrder=0.0, number_format=None, protection=<openpyxl.styles.protection.Protection object> Parameters: locked=True, hidden=False, builtinId=None, hidden=False, xfId=None)[源代码]

基类:openpyxl.descriptors.serialisable.Serialisable

Named and editable styles

alignment

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

as_name()[源代码]

Return relevant named style

as_tuple()[源代码]

Return a style array representing the current style

as_xf()[源代码]

Return equivalent XfStyle

bind(wb)[源代码]

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’>

property xfId

Index of the style in the list of named styles

class openpyxl.styles.named_styles.NamedStyleList(iterable=(), /)[源代码]

基类: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)[源代码]

Append object to the end of the list.

property names