OpenXmlPackage.AddPart<T> Method (T)

Add the part to the document. Must use the returned part to opertate the part added to the doucment

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


Public Overrides Function AddPart(Of T As OpenXmlPart) ( _
    part As T _
) As T
Dim instance As OpenXmlPackage
Dim part As T
Dim returnValue As T

returnValue = instance.AddPart(part)
public override T AddPart<T>(
    T part
where T : OpenXmlPart

Type Parameters

  • T
    Derived class from OpenXmlPart.


  • part
    Type: T
    The part to be added to the document.

Return Value

Type: T
The added part in the doucment. Different from the passed in part.


Exception Condition

Thrown when the part is no allowed to be added.


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

See Also


OpenXmlPackage Class

OpenXmlPackage Members

AddPart Overload

DocumentFormat.OpenXml.Packaging Namespace