[]
Gets the collection of Custom XML parts in the workbook.
Use the returned ICustomXmlPartCollection to add, retrieve, enumerate, or remove workbook-level Custom XML parts. Custom XML parts are stored in the OpenXML package as raw XML payloads and are preserved when saving to OpenXML workbook formats such as XLSX and XLSM.
This API stores and returns the XML bytes only. It does not validate the XML against a schema.
public ICustomXmlPartCollection CustomXmlParts { get; }
Public ReadOnly Property CustomXmlParts As ICustomXmlPartCollection
| Type | Description |
|---|---|
| ICustomXmlPartCollection | The collection of Custom XML parts in the workbook. |
Workbook workbook = new Workbook();
ICustomXmlPart customXmlPart = workbook.CustomXmlParts.Add();
customXmlPart.Data = System.Text.Encoding.UTF8.GetBytes("<payload><customer id=\"42\"/></payload>");
string customXmlPartId = customXmlPart.Id;
ICustomXmlPart samePart = workbook.CustomXmlParts[customXmlPartId];
byte[] xmlData = samePart.Data;