GetXml
Retrieves the XML string from the custom XML part.
Syntax
expression.GetXml();
expression - A variable that represents a ApiCustomXmlPart class.
Parameters
This method doesn't have any parameters.
Returns
string
Example
This example shows how to get the XML content of a custom XML part.
- Code
- Result
// How to get the XML content of an XML part.
// Get XML content.
let presentation = Api.GetPresentation();
let xmlManager = presentation.GetCustomXmlParts();
let xml = xmlManager.Add("<report><title>Monthly Report</title><date>2024-01-01</date></report>");
let xmlContent = xml.GetXml();
let slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();
let fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let shape = Api.CreateShape("rect", 300 * 36000, 130 * 36000, fill, stroke);
shape.SetPosition(608400, 1267200);
let docContent = shape.GetDocContent();
let paragraph = docContent.GetElement(0);
let run = Api.CreateRun();
run.SetFontSize(60);
run.AddText("XML content: " + xmlContent);
paragraph.AddElement(run);
slide.AddObject(shape);