We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question
1

Removing all draw objects from a writer doc? [closed]

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

ticotexas gravatar image

updated 2021-05-21 21:39:19 +0200

Alex Kemp 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 reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2020-07-21 01:39:05.329054

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

Question Tools

1 follower

Stats

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

Seen: 1,309 times

Last updated: Feb 27 '17