跳到主要内容

GetClassType

返回 ApiThemeColorScheme 类的类型。

语法​

expression.GetClassType();

expression - 表示 ApiThemeColorScheme 类的变量。

参数​

此方法没有任何参数。

返回值​

"themeColorScheme"

示例​

获取演示文稿中主题配色方案的类类型。

// How can I identify the type of a color scheme object in a presentation?

// Retrieve the class type identifier and display it for a color scheme in a presentation.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();

const master = presentation.GetMaster(0);
const theme = master.GetTheme();
const colorScheme = Api.CreateThemeColorScheme([
Api.RGB(255, 111, 61), Api.RGB(51, 51, 51), Api.RGB(230, 179, 117), Api.RGB(235, 235, 235),
Api.RGB(163, 21, 21), Api.RGB(128, 43, 43), Api.RGB(0, 0, 0), Api.RGB(128, 128, 128),
Api.RGB(176, 196, 222), Api.RGB(65, 105, 225), Api.RGB(255, 255, 255), Api.RGB(255, 213, 191)
], "New color scheme");
theme.SetColorScheme(colorScheme);

const type = colorScheme.GetClassType();
const fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("flowChartMagneticTape", 300 * 36000, 130 * 36000, fill, stroke);
shape.SetPosition(608400, 1267200);
shape.SetSize(300 * 36000, 130 * 36000);

const docContent = shape.GetDocContent();
const paragraph = docContent.GetElement(0);
paragraph.SetJc("left");
paragraph.AddText("Class type = " + type);
slide.AddObject(shape);