Partager via


OpenXmlPartContainer.DeletePart Method (OpenXmlPart)

Deletes a specified part in the package root layer.

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

Syntax

'Declaration
Public Function DeletePart ( _
    part As OpenXmlPart _
) As Boolean
'Usage
Dim instance As OpenXmlPartContainer
Dim part As OpenXmlPart
Dim returnValue As Boolean

returnValue = instance.DeletePart(part)
public bool DeletePart(
    OpenXmlPart part
)

Parameters

Return Value

Type: System.Boolean
true if the part is successfully removed; otherwise, false. This method also returns false if the part was not found or the parameter is null.

Exceptions

Exception Condition
InvalidOperationException

Thrown when the part is not referenced by this part.

See Also

Reference

OpenXmlPartContainer Class

OpenXmlPartContainer Members

DeletePart Overload

DocumentFormat.OpenXml.Packaging Namespace