openpyxl.styles.fills模块

class openpyxl.styles.fills.Fill[源代码]

基类:openpyxl.descriptors.serialisable.Serialisable

基类

classmethod from_tree(el)[源代码]
tagname = 'fill'
class openpyxl.styles.fills.GradientFill(type='linear', degree=0, left=0, right=0, top=0, bottom=0, stop=())[源代码]

基类:openpyxl.styles.fills.Fill

用渐变填充区域

支持两种渐变填充:

  • type='linear'渐变在一个区域的长度上,在一组指定的停止点之间插入颜色。默认情况下,渐变从左到右,但可以使用“度”属性修改此方向。可以提供颜色列表,它们之间的距离相等。

  • type='path'渐变从区域的每个边缘应用线性渐变。属性Top、Right、Bottom、Left指定来自各个边框的填充范围。因此,top=“0.2”将填充单元格的前20%。

bottom

值的类型必须小于class“float”>

degree

值的类型必须小于class“float”>

fill_type

在python中不允许或混淆所需的属性名(例如“type”)或需要更具描述性的名称(例如“u”的“underline”)时,可以使用别名。

left

值的类型必须小于class“float”>

right

值的类型必须小于class“float”>

stop
tagname = 'gradientFill'
to_tree(tagname=None, namespace=None, idx=None)[源代码]
top

值的类型必须小于class“float”>

type

Value must be one of {'linear', 'path'}

class openpyxl.styles.fills.PatternFill(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', fill_type=None, start_color=None, end_color=None)[源代码]

基类:openpyxl.styles.fills.Fill

用于样式的区域填充图案。注意:如果不指定填充类型,其他属性将不起作用!

bgColor

值的类型必须小于class“openpyxl.styles.colors.color”>

end_color

在python中不允许或混淆所需的属性名(例如“type”)或需要更具描述性的名称(例如“u”的“underline”)时,可以使用别名。

fgColor

值的类型必须小于class“openpyxl.styles.colors.color”>

fill_type

在python中不允许或混淆所需的属性名(例如“type”)或需要更具描述性的名称(例如“u”的“underline”)时,可以使用别名。

patternType

Value must be one of {'gray0625', 'gray125', 'solid', 'darkHorizontal', 'lightGrid', 'lightTrellis', 'lightVertical', 'mediumGray', 'darkTrellis', 'lightGray', 'darkUp', 'darkGrid', 'lightHorizontal', 'lightUp', 'darkDown', 'darkGray', 'darkVertical', 'lightDown'}

start_color

在python中不允许或混淆所需的属性名(例如“type”)或需要更具描述性的名称(例如“u”的“underline”)时,可以使用别名。

tagname = 'patternFill'
to_tree(tagname=None, idx=None)[源代码]
class openpyxl.styles.fills.Stop(color, position)[源代码]

基类:openpyxl.descriptors.serialisable.Serialisable

color

值的类型必须小于class“openpyxl.styles.colors.color”>

position

值的类型必须小于class“float”>

tagname = 'stop'
class openpyxl.styles.fills.StopList(name=None, **kw)[源代码]

基类:openpyxl.descriptors.sequence.Sequence

expected_type

alias of openpyxl.styles.fills.Stop