OpenXmlPartRootXElementExtensions.SetXDocument(OpenXmlPart, XDocument) Method

Definition

Sets the OpenXmlPart's XDocument to the given XDocument, serializes and writes the XDocument to the OpenXmlPart, and reloads the OpenXmlPart's OpenXmlPartRootElement if it was previously loaded.

C#
public static void SetXDocument (this DocumentFormat.OpenXml.Packaging.OpenXmlPart part, System.Xml.Linq.XDocument document);

Parameters

document
XDocument

The XDocument.

Applies to

Product Versions
DocumentFormat.OpenXml 2.15.0, 2.16.0, 2.17.1, 2.18.0, 2.19.0, 2.20.0, 3.0.0, 3.0.1

See also