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

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
ticotexas
Posts: 4
Joined: Tue Nov 09, 2010 5:40 pm

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

Post by ticotexas »

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/h ... ice-writer
Last edited by Hagar Delest on Mon Feb 27, 2017 9:10 am, edited 1 time in total.
Reason: tagged [Solved].
User avatar
robleyd
Moderator
Posts: 5055
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Removing all draw objects from a writer doc?

Post by robleyd »

Cross posted from AskLibreOffice

OP - are the details in your signature up to date?
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
musikai
Volunteer
Posts: 294
Joined: Wed Nov 11, 2015 12:19 am

Re: Removing all draw objects from a writer doc?

Post by musikai »

This will delete ALL graphics:

Code: Select all

sub deleteallGraphics
go = ThisComponent.DrawPage
     For i = go.Count-1 to 0 step -1
       g = go.getByIndex(i)
       g.dispose
     next i
end sub
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
ticotexas
Posts: 4
Joined: Tue Nov 09, 2010 5:40 pm

Re: Removing all draw objects from a writer doc?

Post by ticotexas »

musikai wrote:This will delete ALL graphics:
Wow, thanks! That's perfect. I appreciate the help.
Post Reply