Skip to main content
A newer version of this page is available.
All docs
V19.1
.NET Framework 4.5.2+
Row

ICustomXmlPart.CustomXmlPartDocument Property

Provides access to an XML document contained in a custom XML part.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

XmlDocument CustomXmlPartDocument { get; }

Property Value

Type Description
XmlDocument

A System.Xml.XmlDocument object that is the XML document.

Remarks

Use the CustomXmlPartDocument property to load XML into the custom xml part, read, modify, and remove XML in the document.

Example

This code snippet demonstrates how to access a custom XML part to get the XML document and modify data in that document.

workbook.LoadDocument("Documents\\CustomXml.xlsx");
XmlDocument xmlDoc = workbook.CustomXmlParts[1].CustomXmlPartDocument;
XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
string xPathString = "//whitepaper/contact[firstname='Roger']/firstname";
XmlNodeList xmlNodes = xmlDoc.DocumentElement.SelectNodes(xPathString, nsmgr);
foreach (XmlNode node in xmlNodes) node.InnerText = "Stephen";
workbook.SaveDocument("Documents\\CustomXmlRogerStephen.xlsx");
workbook.Worksheets[0].Cells["A2"].Value = xmlDoc.FirstChild.FirstChild.FirstChild.InnerText;

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomXmlPartDocument property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also