共用方式為


OpenXmlPartContainer.AddPart Method

Definition

Overloads

AddPart<T>(T)

Adds the part to the document. Must use the returned part to operate on the part added to the document.

AddPart<T>(T, String)

Adds the part to the document with a given relationship identifier (ID). Must use the returned part to operate on the part added to the document

AddPart<T>(T)

Adds the part to the document. Must use the returned part to operate on the part added to the document.

public virtual T AddPart<T> (T part) where T : DocumentFormat.OpenXml.Packaging.OpenXmlPart;
abstract member AddPart : 'T -> 'T (requires 'T :> DocumentFormat.OpenXml.Packaging.OpenXmlPart)
override this.AddPart : 'T -> 'T (requires 'T :> DocumentFormat.OpenXml.Packaging.OpenXmlPart)
Public Overridable Function AddPart(Of T As OpenXmlPart) (part As T) As T

Type Parameters

T

Derived class from OpenXmlPart.

Parameters

part
T

The part to be added to the document.

Returns

T

The part added to the document. This is different from the passed in part.

Exceptions

Thrown when "part" is null reference.

Thrown when the part is not allowed to be added.

Thrown when one instance of the same type part already exists and multiple instances of that type are not allowed.

Applies to

AddPart<T>(T, String)

Adds the part to the document with a given relationship identifier (ID). Must use the returned part to operate on the part added to the document

public virtual T AddPart<T> (T part, string id) where T : DocumentFormat.OpenXml.Packaging.OpenXmlPart;
abstract member AddPart : 'T * string -> 'T (requires 'T :> DocumentFormat.OpenXml.Packaging.OpenXmlPart)
override this.AddPart : 'T * string -> 'T (requires 'T :> DocumentFormat.OpenXml.Packaging.OpenXmlPart)
Public Overridable Function AddPart(Of T As OpenXmlPart) (part As T, id As String) As T

Type Parameters

T

Derived class from OpenXmlPart.

Parameters

part
T

The part to be added to the document.

id
String

A unique relationship identifier.

Returns

T

The part added to the document. This is different from the passed in part.

Exceptions

Thrown when "part" or the "id" is null reference.

Thrown when the part is not allowed to be added.

Thrown when one instance of same type part already exists and multiple instances of that type are not allowed.

Applies to