Partager via


OpenXmlCompositeElement.InsertAt<T> Method (T, Int32)

Inserts the specified element at the specified index in children.

Namespace:  DocumentFormat.OpenXml
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
Public Overrides Function InsertAt(Of T As OpenXmlElement) ( _
    newChild As T, _
    index As Integer _
) As T
'Usage
Dim instance As OpenXmlCompositeElement
Dim newChild As T
Dim index As Integer
Dim returnValue As T

returnValue = instance.InsertAt(newChild, _
    index)
public override T InsertAt<T>(
    T newChild,
    int index
)
where T : OpenXmlElement

Type Parameters

  • T

Parameters

  • newChild
    Type: T
    The OpenXmlElement to be inserted.
  • index
    Type: System.Int32
    The zero-based index at which element should be inserted.

Return Value

Type: T
The OpenXmlElement being inserted.

Exceptions

Exception Condition
ArgumentOutOfRangeException

Thrown when index is less than 0 or index is greater than the count of children.

Remarks

No change if the (newChild == null). Just return null.

See Also

Reference

OpenXmlCompositeElement Class

OpenXmlCompositeElement Members

InsertAt Overload

DocumentFormat.OpenXml Namespace