ChangeFillStyles
为当前主题格式方案设置填充样式。
语法
expression.ChangeFillStyles(arrFill);
expression - 表示 ApiThemeFormatScheme 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| arrFill | 必需 | ApiFill[] | 填充样式数组必须包含 3 个元素 - 细微、中等和强烈填充。如果数组为空或数组中有 NoFill 元素,将使用 Api.CreateNoFill() 元素填充。 |
返回值
此方法不返回任何数据。
示例
此示例为当前主题格式方案设置填充样式。
// How to change fill styles of a format scheme.
// Get format scheme and update its fill styles, adding pattern, solid and radial fills.
const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
const master = presentation.GetMaster(0);
const gs1 = Api.CreateGradientStop(Api.RGB(255, 213, 191), 0);
const gs2 = Api.CreateGradientStop(Api.RGB(255, 111, 61), 100000);
const fill1 = Api.CreateRadialGradientFill([gs1, gs2]);
const fill2 = Api.CreatePatternFill("dashDnDiag", Api.RGB(255, 111, 61), Api.RGB(51, 51, 51));
const fill3 = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let theme = slide.GetTheme();
const formatScheme = theme.GetFormatScheme();
formatScheme.ChangeFillStyles([fill1, fill2, fill3]);
const colorScheme = Api.CreateThemeColorScheme([
Api.CreateRGBColor(255, 111, 61), Api.CreateRGBColor(51, 51, 51), Api.CreateRGBColor(230, 179, 117), Api.CreateRGBColor(235, 235, 235),
Api.CreateRGBColor(163, 21, 21), Api.CreateRGBColor(128, 43, 43), Api.CreateRGBColor(0, 0, 0), Api.CreateRGBColor(128, 128, 128),
Api.CreateRGBColor(176, 196, 222), Api.CreateRGBColor(65, 105, 225), Api.CreateRGBColor(255, 255, 255), Api.CreateRGBColor(255, 213, 191)
], "New color scheme");
const fontScheme = Api.CreateThemeFontScheme("Arial", "Noto Sans Simplified Chinese", "Arabic", "Times New Roman", "Noto Serif Simplified Chinese", "Arabic", "New font scheme");
theme = Api.CreateTheme("Theme 1", master, colorScheme, formatScheme, fontScheme);
presentation.ApplyTheme(theme);
const chart = Api.CreateChart("bar3D", [
[200, 240, 280],
[250, 260, 280]
], ["Projected Revenue", "Estimated Costs"], [2014, 2015, 2016], 4051300, 2347595, 24);
chart.SetVerAxisTitle("USD In Hundred Thousands", 10);
chart.SetHorAxisTitle("Year", 11);
chart.SetLegendPos("bottom");
chart.SetShowDataLabels(false, false, true, false);
chart.SetTitle("Financial Overview", 20);
chart.SetSize(300 * 36000, 130 * 36000);
chart.SetPosition(608400, 1267200);
slide.AddObject(chart);