GetXml
从自定义 XML 部件检索 XML 字符串。
语法
expression.GetXml();
expression - 表示 ApiCustomXmlPart 类的变量。
参数
此方法没有任何参数。
返回值
string
示例
读取电子表格中自定义块存储的完整原始 XML 文本。
// How do I retrieve the complete XML string from a stored block of data in a spreadsheet?
// Export the current XML content of a stored block so it can be inspected or reused in a spreadsheet.
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);