跳到主要内容

GetCount

Returns a number of custom XML parts in the XML manager.

Syntax

expression.GetCount();

expression - A variable that represents a ApiCustomXmlParts class.

Parameters

This method doesn't have any parameters.

Returns

number

Example

This example shows how to get the count of custom XML parts in the XML manager.

// How to get the count of custom XML parts.

// Get the count of XML parts.

let worksheet = Api.GetActiveSheet();
let xmlManager = worksheet.GetCustomXmlParts();
xmlManager.Add("<products><item><name>Laptop</name><price>999</price></item></products>");
xmlManager.Add("<user><name>John Doe</name><email>john@example.com</email></user>");
let count = xmlManager.GetCount();
worksheet.GetRange("A1").SetValue("There are " + count + " custom XML parts in the workbook.");