Created attachment 144860 [details] ExtractWriterGraphics attached macro will extract all pictures from a writer document and link it: - open a writer document containing pictures - optional: rename pictures with meaningfull names - run macro: - a *.bak file is created - all pictures will be stored in a folder "pictures" - the document is stored without the pictures, all pictures are linked now. this worked until LO 6.0 but will fail due to change of GraphicURL in LO 6.1, cause it is no longer possible to access the "vnd.sun.star.GraphicObject:" URLs. this macro was very usefull, for example if one has to "refactor" large document containing dozens of pictures. once pictures are exported, one can easily edit/exchange it or even share it with other documents. i suggest adding an API to access pictures again, and/or add a global function to LO writer so all users can benefit from it.
If you already a code for it, you can make an extension and publish it on extensions.libreoffice.org I use special extension for create own extension from existing macroses - BasicAddonBuilder (https://wiki.openoffice.org/wiki/Extensions_Packager , http://calc-info.de/files/BasicAddonBuilder_LibreOffice_0.5.2.oxt). It works fine into LO 5.2 on Windows
Are you sure there is no other way to do the same thing? Did you ask on the developer mailing list? Status set to NEEDINFO, please set it back to UNCONFIRMED once requested informations are provided. Best regards. JBF
i found an announcement with discusson: API-CHANGE - dropping string properties which use vnd.sun.star.GraphicObject URL http://document-foundation-mail-archive.969070.n3.nabble.com/API-CHANGE-dropping-string-properties-which-use-vnd-sun-star-GraphicObject-URL-td4235349.html for example: > How should we find out if a image is embeded in the doc or not ? > we uses for now: > if left(oCheckgraphic1.GraphicURL,27) <> "vnd.sun.star.GraphicObject:" then that is exactly, what i need to make the macro work again.
if one tries to access the Property "GraphicURL": ThisComponent.GraphicObjects.getByIndex(0).GraphicURL an exception is thrown: "GraphicURL, Getting from this property is not unsupported"
(In reply to Oliver Brinzing from comment #4) > if one tries to access the Property "GraphicURL": > > ThisComponent.GraphicObjects.getByIndex(0).GraphicURL > > an exception is thrown: > "GraphicURL, Getting from this property is not unsupported" Same issue with the picextract extension: https://extensions.libreoffice.org/extensions/extract-embedded-images-and-replace-embedded-images-with-linked-images-picextract I think that this API change produces a regression and the API should give another way to do the same thing. I suggest you to open a bug report for that. Best regards. JBF
> (In reply to Oliver Brinzing from comment #4) > I think that this API change produces a regression and the API should give > another way to do the same thing. I suggest you to open a bug report for > that. No that's not a regression - it is an ESC approved API change. "GraphicURL" properties have been deprecated and replaced by "Graphic" property. "GraphicURL" properties are now write only (so you can create a Graphic by specifying a external URL) but can't be read back because the vnd.sun.star.GraphicObject internal URLs don't exist anymore so there is nothing to return back. To determine if a Graphic is internal or external there is now "Linked" property on the Graphic object (XGraphic returned by "Graphic" property). To change the graphic now you need load it with GraphicProvider::queryGraphic and add set "LoadAsLink" to true in the input parameter mediaProperties. Once the graphic is loaded (you have the XGraphic object), you can set it using "Graphic" property instead of "GraphicURL".
Created attachment 146268 [details] ExtractWriterGraphics (LO 6.1) (In reply to Tomaz Vajngerl from comment #6) i think i got it, attached a new macro, thx for guiding me