OpenXmlPartRootXElementExtensions.SetXElement(OpenXmlPart, XElement) Method

Definition

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

C#
public static void SetXElement (this DocumentFormat.OpenXml.Packaging.OpenXmlPart part, System.Xml.Linq.XElement element);

Parameters

element
XElement

The XElement.

Remarks

Effectively sets the Root property of the XDocument returned by GetXDocument(OpenXmlPart).

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