跳到主要内容

Add

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

语法

expression.Add(xml);

expression - 表示 ApiCustomXmlParts 类的变量。

参数

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

返回值

ApiCustomXmlPart

示例

在文档中添加新的自定义 XML 部件并访问它。

// How to add for a custom XML parts in a document?

// Add and display the result in a document.

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);