We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Remove Shape

I’m sorry if this sounds like a stupid question, but how do I remove shapes from a diagram?

The only thing I could find is setting Shape.Del to Aspose.Diagram.BOOL.True, but that doesn’t seem to have any effect.

I tried to ask this via support chat with Mudassir, but got disconnected.

Best regards,

Setting the Shape to null seems to work, at least it’s gone from the file.

Is there a better way?

Hi Chris,

Thank you for contacting support. To remove a shape from the diagram, you can set the shape object to null. It works perfect. There is no other way to remove a shape.

Setting the Shape to null does not always work - I have many Visio files with the “removed” shapes still in them. Also I can still get the Shape by it’s ID, so it is still there somewhere.

But diagram.Pages[0].Shapes.Remove(shape) seems to work reliably. Don’t know why I didn’t see and try that in the first place.
1 Like

Hi Chris,

Thank you for updating us. It’s nice to hear from you that the problem has been resolved. Please let us know in case of any other query or questions about the Aspose APIs.