DocumentFormat.OpenXml by Microsoft

<PackageReference Include="DocumentFormat.OpenXml" Version="2.15.0" />

.NET API 6,024,624 bytes

 OpenXmlElement

Represents a base class that all elements in an Office Open XML document derive from.
public virtual OpenXmlElementList ChildElements { get; }

Gets all the child nodes of the current element.

Gets all extended attributes (attributes not defined in the schema) of the current element.

public IFeatureCollection Features { get; }

Gets a IFeatureCollection for the current element. This feature collection will be read-only, but will inherit features from its parent part and package if available.

public virtual OpenXmlElement FirstChild { get; }

Gets the first child of the OpenXmlElement element. Returns null (Nothing in Visual Basic) if there is no such OpenXmlElement element.

public bool HasAttributes { get; }

Gets a value indicating whether the current element has any attributes.

public abstract bool HasChildren { get; }

Gets a value indicating whether the current element has any child elements.

public virtual string InnerText { get; protected set; }

Gets or sets the concatenated values of the node and all of its children.

public virtual string InnerXml { get; set; }

Gets or sets the markup that represents only the child elements of the current element.

public virtual OpenXmlElement LastChild { get; }

Gets the last child of the OpenXmlElement element. Returns null (Nothing in Visual Basic) if there is no such OpenXmlElement element.

public virtual string LocalName { get; }

Gets the local name of the current element.

Gets or sets the markup compatibility attributes. Returns null if no markup compatibility attributes are defined for the current element.

public IEnumerable<KeyValuePair<string, string>> NamespaceDeclarations { get; }

Gets all the namespace declarations defined in the current element. Returns an empty enumerator if there is no namespace declaration.

public virtual string NamespaceUri { get; }

Gets the namespace URI of the current element.

Gets the OpenXmlElementContext of the current element.

public string OuterXml { get; }

Gets the markup that represents the current element and all of its child elements.

public OpenXmlElement Parent { get; }

Gets the parent element of the current element.

public virtual string Prefix { get; }

Gets the namespace prefix of current element.

public virtual XmlQualifiedName XmlQualifiedName { get; }

Gets the qualified name of the current element.

public virtual XName XName { get; }

Gets the qualified name of the current element.

protected OpenXmlElement()

Initializes a new instance of the OpenXmlElement class.

protected OpenXmlElement(string outerXml)

Initializes a new instance of the OpenXmlElement class using the supplied outer XML of the element.

public void AddAnnotation(object annotation)

Adds an object to the current OpenXmlElement element's list of annotations.

public void AddNamespaceDeclaration(string prefix, string uri)

Adds a namespace declaration to the current node.

Enumerates all of the current element's ancestors.

public IEnumerable<T> Ancestors<T>() where T : OpenXmlElement

Enumerates only the current element's ancestors that have the specified type.

public T Annotation<T>()

Get the first annotation object of the specified type from the current OpenXmlElement element.

public object Annotation(Type type)

Get the first annotation object of the specified type from the current OpenXmlElement element.

public IEnumerable<T> Annotations<T>()

Gets a collection of annotations with the specified type for the current OpenXmlElement element.

public IEnumerable<object> Annotations(Type type)

Gets a collection of annotations with the specified type for the current OpenXmlElement element.

public void Append(IEnumerable<OpenXmlElement> newChildren)

Appends each element from a list of elements to the end of the current element's list of child elements.

public void Append(OpenXmlElement[] newChildren)

Appends each element from an array of elements to the end of the current element's list of child elements.

public virtual T AppendChild<T>(T newChild) where T : OpenXmlElement

Appends the specified element to the end of the current element's list of child nodes.

public void ClearAllAttributes()

Clears all of the attributes, including both known attributes and extended attributes.

public object Clone()

Creates a duplicate of the current node.

public virtual OpenXmlElement CloneNode(bool deep)

When overridden in a derived class, creates a duplicate of the node.

public IEnumerable<T> Descendants<T>() where T : OpenXmlElement

Enumerate all of the current element's descendants of type T.

Enumerates all of the current element's descendants.

public IEnumerable<T> Elements<T>() where T : OpenXmlElement

Enumerates only the current element's children that have the specified type.

Enumerates all of the current element's children.

Enumerates all of the sibling elements that follow the current element and have the same parent as the current element.

Enumerates all of the sibling elements that precede the current element and have the same parent as the current element.

public OpenXmlAttribute GetAttribute(string localName, string namespaceUri)

Gets an Open XML attribute with the specified tag name and namespace URI.

Gets a list that contains a copy of all the attributes.

Returns an enumerator that iterates through the child collection.

public T GetFirstChild<T>() where T : OpenXmlElement

Finds the first child element in type T.

public virtual T InsertAfter<T>(T newChild, OpenXmlElement referenceChild) where T : OpenXmlElement

Inserts the specified element immediately after the specified reference element.

public T InsertAfterSelf<T>(T newElement) where T : OpenXmlElement

Inserts the specified element immediately after the current element.

public virtual T InsertAt<T>(T newChild, int index) where T : OpenXmlElement

Inserts the specified element at the specified index in the current element's list of child elements.

public virtual T InsertBefore<T>(T newChild, OpenXmlElement referenceChild) where T : OpenXmlElement

Inserts the specified element immediately before the specified reference element.

public T InsertBeforeSelf<T>(T newElement) where T : OpenXmlElement

Inserts the specified element immediately before the current element.

public bool IsAfter(OpenXmlElement element)

Determines if the current element appears after a specified element in document order.

public bool IsBefore(OpenXmlElement element)

Determines if the current element appears before a specified element in document order.

public string LookupNamespace(string prefix)

Resolves the namespace prefix in the context of the current node.

public string LookupPrefix(string namespaceUri)

Finds the corresponding prefix for a namespace uri in the current element scope.

Gets the OpenXmlElement element that immediately follows the current OpenXmlElement element. Returns null (Nothing in Visual Basic) if there is no next OpenXmlElement element.

public T NextSibling<T>() where T : OpenXmlElement

Gets the OpenXmlElement element with the specified type that follows the current OpenXmlElement element. Returns null (Nothing in Visual Basic) if there is no next OpenXmlElement.

public virtual T PrependChild<T>(T newChild) where T : OpenXmlElement

Inserts the specified element at the beginning of the current element's list of child elements.

Gets the OpenXmlElement element that immediately precedes the current OpenXmlElement element. Returns null (Nothing in Visual Basic ) if there is no preceding OpenXmlElement element.

public T PreviousSibling<T>() where T : OpenXmlElement

Gets the OpenXmlElement element with the specified type that precedes the current OpenXmlElement. Returns null (Nothing in Visual Basic) if there is no preceding OpenXmlElement element.

public void Remove()

Removes the current element from its parent.

public abstract void RemoveAllChildren()

Removes all of the current element's child elements.

public void RemoveAllChildren<T>() where T : OpenXmlElement

Remove all of the current element's child elements that are of type T.

public void RemoveAnnotations<T>()

Removes the annotations with the specified type from the current OpenXmlElement element.

public void RemoveAnnotations(Type type)

Removes the annotations of the specified type from the current OpenXmlElement element.

public void RemoveAttribute(string localName, string namespaceUri)

Removes the attribute from the current element.

public virtual T RemoveChild<T>(T oldChild) where T : OpenXmlElement

Removes the specified child element from the current element's list of child elements.

public void RemoveNamespaceDeclaration(string prefix)

Removes the namespace declaration for the specified prefix. Removes nothing if there is no prefix.

public virtual T ReplaceChild<T>(OpenXmlElement newChild, T oldChild) where T : OpenXmlElement

Replaces a child element with another child element in the current element's list of child elements.

public void SetAttribute(OpenXmlAttribute openXmlAttribute)

Sets an attribute to the specified element. If the attribute is a known attribute, the value of the attribute is set. If the attribute is an extended attribute, the 'openxmlAttribute' is added to the extended attributes list.

public void SetAttributes(IEnumerable<OpenXmlAttribute> openXmlAttributes)

Sets a number of attributes to the element. If an attribute is a known attribute, the value of the attribute is set. If an attribute is an extended attribute, the 'openxmlAttribute' is added to the extended attributes list.

public virtual void WriteTo(XmlWriter xmlWriter)

Saves the current node to the specified XmlWriter.