GetClassType
返回 ApiCustomXmlNode 类的类型。
语法
expression.GetClassType();
expression - 表示 ApiCustomXmlNode 类的变量。
参数
此方法没有任何参数。
返回值
"customXmlNode"
示例
此示例演示如何获取自定义 XML 节点的类类型并显示它。
// How to get the class type of an XML node.
// Get the class type.
let presentation = Api.GetPresentation();
let xmlManager = presentation.GetCustomXmlParts();
let xmlText = `
<?xml version="1.0" encoding="UTF-8"?>
<zoo>
<animal species="Lion" id="101">
<name>Leo</name>
<age>5</age>
<habitat>Savanna</habitat>
<diet>Carnivore</diet>
</animal>
</zoo>`;
let xml = xmlManager.Add(xmlText);
let node = xml.GetNodes('/zoo/animal')[0];
let classType = node.GetClassType();
let slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let shape = Api.CreateShape("rect", 300 * 36000, 130 * 36000, fill, stroke);
shape.SetPosition(608400, 1267200);
let docContent = shape.GetDocContent();
let paragraph = docContent.GetElement(0);
let run = Api.CreateRun();
run.SetFontSize(60);
run.AddText("Class type of the node: " + classType);
paragraph.AddElement(run);
slide.AddObject(shape);