FillFormat类

FillFormat类

封装表示形状填充格式的对象。

FillFormat 类型公开了以下成员:

特性

属性描述
type获取和设置填充类型。
fill_type获取和设置填充类型
transparency将区域的透明度返回或设置为从 0.0(不透明)到 1.0(透明)的值。
set_type获取填充格式集类型。
gradient_fill获取 FillFormat.gradient_fill 对象。
texture_fill获取 FillFormat.texture_fill 对象。
solid_fill获取 FillFormat.solid_fill 对象。
pattern_fill获取 FillFormat.pattern_fill 对象。
gradient_color_type返回指定填充的渐变颜色类型。
gradient_style返回指定填充的渐变样式。
gradient_color1返回指定填充的渐变颜色 1。
gradient_color2返回指定填充的渐变颜色 2。
gradient_degree返回指定填充的渐变度。
仅适用于 Excel 2007。
gradient_variant返回指定填充的渐变变体。
仅适用于 Excel 2007。
preset_color返回指定填充的渐变预设颜色。
texture表示指定填充的纹理类型。
pattern表示一个区域的显示模式。
picture_format_type获取和设置图片格式类型。
scale获取和设置图片格式比例。
image_data获取和设置图片图像数据。

方法

方法描述
set_two_color_gradient(color1, color2, style, variant)将指定的填充设置为双色渐变。
仅适用于 Excel 2007。
set_two_color_gradient(color1, transparency1, color2, transparency2, style, variant)将指定的填充设置为双色渐变。
仅适用于 Excel 2007。
set_one_color_gradient(color, degree, style, variant)将指定的填充设置为单色渐变。
仅适用于 Excel 2007。
set_preset_color_gradient(preset_color, style, variant)将指定的填充设置为预设颜色渐变。
仅适用于 Excel 2007。

例子

from aspose.cells import Workbook
from aspose.cells.charts import ChartType
from aspose.cells.drawing import GradientStyleType
from aspose.pydrawing import Color

# Instantiating a Workbook object
workbook = Workbook()
# Adding a new worksheet to the Excel object
sheetIndex = workbook.worksheets.add()
# Obtaining the reference of the newly added worksheet by passing its sheet index
worksheet = workbook.worksheets[sheetIndex]
# Adding a sample value to "A1" cell
worksheet.cells.get("A1").put_value(50)
# Adding a sample value to "A2" cell
worksheet.cells.get("A2").put_value(100)
# Adding a sample value to "A3" cell
worksheet.cells.get("A3").put_value(150)
# Adding a sample value to "A4" cell
worksheet.cells.get("A4").put_value(200)
# Adding a sample value to "B1" cell
worksheet.cells.get("B1").put_value(60)
# Adding a sample value to "B2" cell
worksheet.cells.get("B2").put_value(32)
# Adding a sample value to "B3" cell
worksheet.cells.get("B3").put_value(50)
# Adding a sample value to "B4" cell
worksheet.cells.get("B4").put_value(40)
# Adding a sample value to "C1" cell as category data
worksheet.cells.get("C1").put_value("Q1")
# Adding a sample value to "C2" cell as category data
worksheet.cells.get("C2").put_value("Q2")
# Adding a sample value to "C3" cell as category data
worksheet.cells.get("C3").put_value("Y1")
# Adding a sample value to "C4" cell as category data
worksheet.cells.get("C4").put_value("Y2")
# Adding a chart to the worksheet
chartIndex = worksheet.charts.add(ChartType.COLUMN, 5, 0, 15, 5)
# Accessing the instance of the newly added chart
chart = worksheet.charts[chartIndex]
# Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
seriesIndex = chart.n_series.add("A1:B4", True)
# Setting the data source for the category data of NSeries
chart.n_series.category_data = "C1:C4"
# Filling the area of the 2nd NSeries with a gradient
chart.n_series[seriesIndex].area.fill_format.set_one_color_gradient(Color.lime, 1, GradientStyleType.HORIZONTAL, 1)

也可以看看