OpenXmlCompositeElement.AddChild(OpenXmlElement, Boolean) Method

Definition

Adds the specified element to the element if it is a known child. This adds the element in the correct location according to the schema.

C#
public bool AddChild (DocumentFormat.OpenXml.OpenXmlElement newChild, bool throwOnError = true);

Parameters

newChild
OpenXmlElement

The OpenXmlElement element to append.

throwOnError
Boolean

A flag to indicate if the method should throw if the child could not be added.

Returns

Success if the element was added, otherwise false.

Applies to

Product Versions
DocumentFormat.OpenXml 2.12.0, 2.12.1, 2.12.2, 2.12.3, 2.13.0, 2.13.1, 2.14.0, 2.15.0, 2.16.0, 2.17.1, 2.18.0, 2.19.0, 2.20.0, 3.0.0, 3.0.1