跳到主要内容

GetXml

从自定义 XML 部件检索 XML 字符串。

语法

expression.GetXml();

expression - 表示 ApiCustomXmlPart 类的变量。

参数

此方法没有任何参数。

返回值

string

示例

此示例演示如何获取自定义 XML 部件的 XML 内容。

// How to get the XML content of an XML part.

// Get XML content.

let worksheet = Api.GetActiveSheet();
let xmlManager = worksheet.GetCustomXmlParts();
let xml = xmlManager.Add("<report><title>Monthly Report</title><date>2024-01-01</date></report>");
let xmlContent = xml.GetXml();
worksheet.GetRange("A1").SetValue("XML content:");
worksheet.GetRange("A2").SetValue(xmlContent);