OpenXmlPartContainer.AddNewPart<T> Method

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Adds a new part of type T.

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

Syntax

'Declaration
Public Function AddNewPart(Of T As {OpenXmlPart, IFixedContentTypePart}) As T
'Usage
Dim instance As OpenXmlPartContainer
Dim returnValue As T

returnValue = instance.AddNewPart()
public T AddNewPart<T>()
where T : OpenXmlPart, IFixedContentTypePart

Type Parameters

  • T
    The class of the part.

Return Value

Type: T
Returns the added part.

Exceptions

Exception Condition
OpenXmlPackageException

Throws an exception when the part is not allowed to be referenced by this part.

See Also

Reference

OpenXmlPartContainer Class

OpenXmlPartContainer Members

AddNewPart Overload

DocumentFormat.OpenXml.Packaging Namespace