All docs
V20.2
21.1 (EAP/Beta)
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

ICustomXmlPart Interface

A custom XML part embedded in a document.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v20.2.Core.dll

Declaration

public interface ICustomXmlPart :
    OfficeCustomXmlPart<ICustomXmlPart>,
    OfficeCustomXmlPart

Remarks

You can embed arbitrary XML data (called custom XML parts) in documents in DOCX and DOC format. Custom XML parts are included in the document structure but are not visible in the document.

The image below shows the structure of a DOCX file with three custom XML parts (item1, item2, and item3).

Document_CustomXmlParts

A custom XML part is an object that exposes the ICustomXmlPart interface. Use the Document.CustomXmlParts property to access the CustomXmlPartCollection collection that stores custom XML parts.

You can use a custom XML part's index to obtain it from the collection. Use the CustomXmlPartDocument property to access an XML document associated with the ICustomXmlPart object.

using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using System.Xml;
// ...

using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
    Document document = wordProcessor.Document;
    // Load a document.
    document.LoadDocument("Documents\\CustomXmlParts.docx");
    // Access a custom XML file stored in the document.
    XmlDocument xmlDoc = document.CustomXmlParts[0].CustomXmlPartDocument;
    // Retrieve employee names from the XML file and display them in the document.
    XmlNodeList nameList = xmlDoc.GetElementsByTagName("Name");
    document.AppendText("Employee list:");
    foreach (XmlNode name in nameList)
    {
        document.AppendText("\r\n \u00B7 " + name.InnerText);
    }
}
See Also