Is there a basic macro that can delete all draw objects from a document? I found one that can delete graphic objects, but I can’t figure out how to modify it to delete draw objects.
Thank you Lupp. That works perfect! Someone else helped with a way to delete all graphics, images, and draw objects where I asked here: [Solved] Removing all draw objects from a writer doc? (View topic) • Apache OpenOffice Community Forum
A Writer document has one DrawPage. You can enumerate the objects inserted into the DrawPage, among them those creatable with the help of the drawing tools, and make distinctions based on some property. All the “draw objects” should support the service “com.sun.star.drawing.Shape” I suppose. (The SupportsService function is case sensitive!)
A raw sketch:
Sub clearDrawPageFromShapes theDrawPage = ThisComponent.DrawPage theEnum = theDrawPage.CreateEnumeration Do While theEnum.HasMoreElements theElement = theEnum.NextElement If theElement.SupportsService("com.sun.star.drawing.Shape") Then theElement.Dispose End If Loop End Sub