OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Deleting images from the DocumentStorage

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
ibvhefe
General User
General User


Joined: 19 Jul 2007
Posts: 27

PostPosted: Thu Jul 03, 2008 5:00 am    Post subject: Deleting images from the DocumentStorage Reply with quote

Hi folks!

Yet another problem with Basic ;-(

I once added an image to the DocumentStorage using BitmapTable:


Code:
   cFile = "C:\randomPic.png"
   cInternalName = "LogoXYZ"
   
   cUrl = ConvertToUrl( cFile )
   oBitmaps = thisComponent.createInstance( "com.sun.star.drawing.BitmapTable" )
   oBitmaps.insertByName( cInternalName, cUrl )


And now I want to delete it again.

But unfortunatelly I found following Comment in the API:

Code:
[b]BitmapTable[/b]

Description
    this container lets you access the URLs that are indexed with a name.
    Note: You can add new entries for later use, [b]but you cannot remove entries[/b] that are used inside the document.


Does anyone know a work-around? ;-(

I would love you!
Back to top
View user's profile Send private message
Fernand
OOo Enthusiast
OOo Enthusiast


Joined: 22 Jun 2004
Posts: 142

PostPosted: Thu Jul 03, 2008 6:14 am    Post subject: Reply with quote

delete de graphic in the document itself ?
Back to top
View user's profile Send private message Send e-mail
ibvhefe
General User
General User


Joined: 19 Jul 2007
Posts: 27

PostPosted: Thu Jul 03, 2008 7:03 am    Post subject: Reply with quote

okay, let me try to explain it, another way:

lets say I have a document called

test.odt

if I rename it into

test.zip

and open the picture folder inside of it

there are too many JPGs and PNGs that are not used anywhere.

How to get rid of them?
Back to top
View user's profile Send private message
ibvhefe
General User
General User


Joined: 19 Jul 2007
Posts: 27

PostPosted: Thu Jul 03, 2008 7:26 am    Post subject: Reply with quote

okay, I found the answer myself.

If you want to delete pictures from the DocumentStorage, do the following:

1. test.odt ---> test.zip
2. open test.zip
3. go to /pictures/
4. choose the picture you dont like (e.g. 10000201000000D1000000193E771149.png)
5. go to /Meta-Inf/manifest.xml
6. open the file with an editor
7. look out for the line, which contains 10000201000000D1000000193E771149.png
8. delete the line
9. test.zip ---> test.odt

you are done Wink
Back to top
View user's profile Send private message
Fernand
OOo Enthusiast
OOo Enthusiast


Joined: 22 Jun 2004
Posts: 142

PostPosted: Thu Jul 03, 2008 11:10 pm    Post subject: Reply with quote

We are here in the macro and API section no ? Smile so there is a way to do this rhings using thze API.

When the graphics are no longer used then the are no longer in the xml file either ? or is there a way to corrupt a file in that sence ?

Fernand
Back to top
View user's profile Send private message Send e-mail
ibvhefe
General User
General User


Joined: 19 Jul 2007
Posts: 27

PostPosted: Fri Jul 04, 2008 2:03 pm    Post subject: Reply with quote

yeah, there is.

Have a look at the codesnipplet in my first post.

It's a one way ticket to your document Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group