跳到主要内容

Add

向 XML 管理器添加新的自定义 XML 部件。

语法

expression.Add(xml);

expression - 表示 ApiCustomXmlParts 类的变量。

参数

名称必需/可选数据类型默认值描述
xml必需string要添加的 XML 字符串。

返回值

ApiCustomXmlPart

示例

此示例演示如何添加新的自定义 XML 部件然后访问它。

let doc = Api.GetDocument();
let xmlManager = doc.GetCustomXmlParts();
let newXml = xmlManager.Add("<content xmlns='http://example' version='1.0'></content>");
let infoParagraph = Api.CreateParagraph();
infoParagraph.AddText("New XML part added: " + newXml.GetXml());
doc.Push(infoParagraph);