.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
A newer version of this page is available. Switch to the current version.

ICustomXmlPart Interface

Defines the custom XML part embedded in a workbook.

Namespace: DevExpress.Spreadsheet

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


public interface ICustomXmlPart


A document in OpenXml (.xlsx) format consists of XML files within folders packed in a ZIP archive. Most of the XML files are built-in parts that define the document structure and hold its content. However, documents can also contain custom XML parts, which you can use to store arbitrary XML data.

A custom XML part is an object that exposes the ICustomXmlPart interface. All custom XML parts are contained in the CustomXmlPartCollection collection accessible using the IWorkbook.CustomXmlParts property.


This code snippet demonstrates how to use XPath query to obtain information from the document’s custom XML part.

The custom XML part is accessed by its index in the IWorkbook.CustomXmlParts collection. The XML document contained in a custom XML part is available using the ICustomXmlPart.CustomXmlPartDocument property. To find the specified XML node, the XPath query is supplied to the SelectSingleNode method of the XmlDocument object. The obtained string is inserted into the active worksheet as a Hyperlink.

XmlDocument xmlDoc = workbook.CustomXmlParts[0].CustomXmlPartDocument;
XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
string xPathString = "//Fish[Category='Cod']/ScientificClassification/Reference";
XmlNode xmlNode = xmlDoc.DocumentElement.SelectSingleNode(xPathString, nsmgr);
string hLink = xmlNode.InnerText;
workbook.Worksheets[0].Hyperlinks.Add(workbook.Worksheets[0].Cells["A2"], hLink, true);
See Also