OpenXmlPartContainer.AddNewPart OpenXmlPartContainer.AddNewPart OpenXmlPartContainer.AddNewPart Method

Definition

Overloads

AddNewPart<T>(String, String) AddNewPart<T>(String, String) AddNewPart<T>(String, String)

Adds a new part of type T.

AddNewPart<T>(String) AddNewPart<T>(String) AddNewPart<T>(String)

Adds a new part of type T.

AddNewPart<T>() AddNewPart<T>() AddNewPart<T>()

Adds a new part of type T.

AddNewPart<T>(String, String) AddNewPart<T>(String, String) AddNewPart<T>(String, String)

Adds a new part of type T.

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

Type Parameters

T

The class of the part.

Parameters

contentType
String String String

The content type of the part. Must match the defined content type if the part is fixed content type.

id
String String String

The relationship id. The id will be automaticly generated if this param is null.

Returns

T T T

The added part.

Exceptions

When the part is not allowed to be referenced by this part.

When the part is fixed content type and the passed in contentType does not match the defined content type.

Remarks

Mainly used for adding not-fixed content type part - ImagePart, VideoPart, AudioPart, etc

AddNewPart<T>(String) AddNewPart<T>(String) AddNewPart<T>(String)

Adds a new part of type T.

public T AddNewPart<T> (string id) where T : DocumentFormat.OpenXml.Packaging.OpenXmlPart, DocumentFormat.OpenXml.Packaging.IFixedContentTypePart;
member this.AddNewPart : string -> 'T (requires 'T :> DocumentFormat.OpenXml.Packaging.OpenXmlPart and 'T :> DocumentFormat.OpenXml.Packaging.IFixedContentTypePart)
Public Function AddNewPart(Of T As {OpenXmlPart, IFixedContentTypePart}) (id As String) As T

Type Parameters

T

The class of the part.

Parameters

id
String String String

The relationship id.

Returns

T T T

The added part.

Exceptions

When the part is not allowed to be referenced by this part.

AddNewPart<T>() AddNewPart<T>() AddNewPart<T>()

Adds a new part of type T.

public T AddNewPart<T> () where T : DocumentFormat.OpenXml.Packaging.OpenXmlPart, DocumentFormat.OpenXml.Packaging.IFixedContentTypePart;
member this.AddNewPart : unit -> 'T (requires 'T :> DocumentFormat.OpenXml.Packaging.OpenXmlPart and 'T :> DocumentFormat.OpenXml.Packaging.IFixedContentTypePart)
Public Function AddNewPart(Of T As {OpenXmlPart, IFixedContentTypePart}) () As T

Type Parameters

T

The class of the part.

Returns

T T T

The added part.

Exceptions

When the part is not allowed to be referenced by this part.

Applies to