Compartilhar via


OpenXmlPackage.DeletePart Method (DataPart)

Deletes the sepcified DataPart from the document package.

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

Syntax

'Declaration
Public Function DeletePart ( _
    dataPart As DataPart _
) As Boolean
'Usage
Dim instance As OpenXmlPackage
Dim dataPart As DataPart
Dim returnValue As Boolean

returnValue = instance.DeletePart(dataPart)
public bool DeletePart(
    DataPart dataPart
)

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 dataPart is referenced by other part in the document package.

See Also

Reference

OpenXmlPackage Class

OpenXmlPackage Members

DeletePart Overload

DocumentFormat.OpenXml.Packaging Namespace