PresentationDocument.AddNewPart<T>-Methode (String, String)
Adds a new part of type .
Namespace: DocumentFormat.OpenXml.Packaging
Assembly: DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)
Syntax
'Declaration
Public Overrides Function AddNewPart(Of T As OpenXmlPart) ( _
contentType As String, _
id As String _
) As T
'Usage
Dim instance As PresentationDocument
Dim contentType As String
Dim id As String
Dim returnValue As T
returnValue = instance.AddNewPart(contentType, _
id)
public override T AddNewPart<T>(
string contentType,
string id
)
where T : OpenXmlPart
Typparameter
- T
The class of the part.
Parameter
- contentType
Typ: System.String
The content type of the part. Must match the defined content type if the part is fixed content type.
- id
Typ: System.String
The relationship id. The id will be automaticly generated if this param is null.
Rückgabewert
Typ: T
The added part.
Ausnahmen
Ausnahme | Bedingung |
---|---|
OpenXmlPackageException | When the part is not allowed to be referenced by this part. |
ArgumentOutOfRangeException | When the part is fixed content type and the passed in contentType does not match the defined content type. |
ArgumentNullException | Thrown when "contentType" is null reference. |
Hinweise
Mainly used for adding not-fixed content type part - ImagePart, VideoPart, AudioPart, etc