Ask Your Question
1

Removing all draw objects from a writer doc?

asked 2017-02-27 00:21:49 +0200

ticotexas gravatar image

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.

that macro is here: http://askubuntu.com/questions/259704...

edit retag flag offensive close merge delete

Comments

Thank you Lupp. That works perfect! Someone else helped with a way to delete all graphics, images, and draw objects where I asked here: https://forum.openoffice.org/en/forum...

ticotexas gravatar imageticotexas ( 2017-02-27 02:04:34 +0200 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2017-02-27 01:13:04 +0200

Lupp gravatar image

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
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-02-27 00:21:49 +0200

Seen: 555 times

Last updated: Feb 27 '17