All docs
V21.1
21.1
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+

OfficeCustomXmlPartCollection<T>.Remove(T) Method

Removes the specified custom XML part from the collection.

Namespace: DevExpress.Office

Assembly: DevExpress.Office.v21.1.Core.dll

Declaration

void Remove(
    T customXmlPart
)

Parameters

Name Type Description
customXmlPart T

A custom XML part to remove from the collection.

Remarks

Use the Clear method to remove all items from CustomXmlPartCollection associated with a text document or workbook.

The example below shows how to remove custom XML parts from a DOCX file.

using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
    Document document = wordProcessor.Document;
    document.AppendText("This document contains custom XML parts.");

    // Add the first custom XML part.
    string xmlString1 = @"<?xml version=""1.0"" encoding=""UTF-8""?>
                            <Employees>
                                <FirstName>Stephen</FirstName>
                                <LastName>Edwards</LastName>
                            </Employees>";
    var xmlItem1 = document.CustomXmlParts.Add(xmlString1);

    // Add the second custom XML part.
    string xmlString2 = @"<?xml version=""1.0"" encoding=""UTF-8""?>
                            <Employees>
                                <FirstName>Andrew</FirstName>
                                <LastName>Fuller</LastName>
                            </Employees>";
    var xmlItem2 = document.CustomXmlParts.Add(xmlString2);

    // Remove the first item from the collection.
    document.CustomXmlParts.Remove(xmlItem1);
    // Use the RemoveAt method to remove an item at the specified position from the collection.
    // document.CustomXmlParts.RemoveAt(0);
    // Use the Clear method to remove all items from the collection.
    // document.CustomXmlParts.Clear();
}
See Also