共用方式為


OpenXmlElement.ReplaceChild<T>(OpenXmlElement, T) Method

Definition

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

public virtual T ReplaceChild<T> (DocumentFormat.OpenXml.OpenXmlElement newChild, T oldChild) where T : DocumentFormat.OpenXml.OpenXmlElement;
public virtual T ReplaceChild<T> (DocumentFormat.OpenXml.OpenXmlElement newChild, T? oldChild) where T : DocumentFormat.OpenXml.OpenXmlElement;
public virtual T? ReplaceChild<T> (DocumentFormat.OpenXml.OpenXmlElement newChild, T? oldChild) where T : DocumentFormat.OpenXml.OpenXmlElement;
abstract member ReplaceChild : DocumentFormat.OpenXml.OpenXmlElement * 'T -> 'T (requires 'T :> DocumentFormat.OpenXml.OpenXmlElement)
override this.ReplaceChild : DocumentFormat.OpenXml.OpenXmlElement * 'T -> 'T (requires 'T :> DocumentFormat.OpenXml.OpenXmlElement)
Public Overridable Function ReplaceChild(Of T As OpenXmlElement) (newChild As OpenXmlElement, oldChild As T) As T

Type Parameters

T

Parameters

newChild
OpenXmlElement

The new child element to put in the list.

oldChild
T

The child element to replace in the list.

Returns

T

The OpenXmlElement element that was replaced.

Applies to