Re: [api-dev] embedding an image to open office documents
Hello allirpa, On Saturday 07 March 2009, 10:06, allirpa wrote: by the way, what's the difference if the image is embedded or displayed? if you store the image using the embed API, you can use it for any purpose, and the user has no way to get rid of it in the UI. An image embedded as text graphic object, sure disapears if the user deletes it. Sure you google and found different ways of embedding a text graphic object. The way I like the most is the following: instead of setting the GraphicURL property http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextGraphicObject.html#GraphicURL set the Graphic property http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextGraphicObject.html#Graphic Just replace in this example the property name and the object reference http://svn.services.openoffice.org/opengrok/xref/DEV300_m42/odk/examples/java/Text/GraphicsInserter.java#155 // Setting the graphic XGraphic xGraphic = getGraphicFromURL( xComponentContext, sGraphicFileURL); xPropSet.setPropertyValue(Graphic, xGraphic); where getGraphicFromURL is public XGraphic getGraphicFromURL( XComponentContext xContext, String sURL ){ XGraphic xGraphic = null; try { XGraphicProvider xGraphicProvider = (XGraphicProvider) UnoRuntime.queryInterface( XGraphicProvider.class, xContext.getServiceManager().createInstanceWithContext( com.sun.star.graphic.GraphicProvider, xContext)); PropertyValue[] aMediaProperties = new PropertyValue[1]; aMediaProperties[0] = new PropertyValue(); aMediaProperties[0].Name = URL; aMediaProperties[0].Value = sURL; xGraphic = xGraphicProvider.queryGraphic(aMediaProperties); } catch (Exception e) { e.printStackTrace(); } finally { return xGraphic; } } Regards -- Ariel Constenla-Haile La Plata, Argentina Aus der Kriegsschule des Lebens - Was mich nicht umbringt, macht mich härter. Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] embedding an image to open office documents
On Sunday 08 March 2009, 08:56, Ariel Constenla-Haile wrote: Sure you google and found different ways of embedding a text graphic object. The way I like the most is the following: instead of setting the GraphicURL property http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextGraphicObject.html#GraphicURL set the Graphic property http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextGraphicObject.html#Graphic Just replace in this example the property name and the object reference http://svn.services.openoffice.org/opengrok/xref/DEV300_m42/odk/examples/java/Text/GraphicsInserter.java#155 this example is for Writer of course. If you want a generic solution, use a com.sun.star.drawing.GraphicObjectShape http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/GraphicObjectShape.html In this case, also set the css.graphic.XGraphic instead of the GraphicURL http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/GraphicObjectShape.html#Graphic (do not follow the old work-around described in http://codesnippets.services.openoffice.org/Calc/Calc.InsertGfx.snip ...mmm this must be updated). Regards -- Ariel Constenla-Haile La Plata, Argentina Aus der Kriegsschule des Lebens - Was mich nicht umbringt, macht mich härter. Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] embedding an image to open office documents
Ariel Constenla-Haile wrote: On Sunday 08 March 2009, 08:56, Ariel Constenla-Haile wrote: Sure you google and found different ways of embedding a text graphic object. The way I like the most is the following: instead of setting the GraphicURL property http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextGraphicObject.html#GraphicURL set the Graphic property http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextGraphicObject.html#Graphic Just replace in this example the property name and the object reference http://svn.services.openoffice.org/opengrok/xref/DEV300_m42/odk/examples/java/Text/GraphicsInserter.java#155 this example is for Writer of course. If you want a generic solution, use a com.sun.star.drawing.GraphicObjectShape http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/GraphicObjectShape.html In this case, also set the css.graphic.XGraphic instead of the GraphicURL http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/GraphicObjectShape.html#Graphic (do not follow the old work-around described in http://codesnippets.services.openoffice.org/Calc/Calc.InsertGfx.snip ...mmm this must be updated). Regards -- Ariel Constenla-Haile La Plata, Argentina Aus der Kriegsschule des Lebens - Was mich nicht umbringt, macht mich härter. Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org thanks a lot Ariel! I'm going to try this now. thank you very much. may you never get tired of helping people in this forum. =) Salamat. (Thank you, in Filipino :) ) -- View this message in context: http://www.nabble.com/embedding-an-image-to-open-office-documents-tp22386730p22397167.html Sent from the openoffice - api dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] embedding an image to open office documents
Ariel Constenla-Haile wrote: On Sunday 08 March 2009, 08:56, Ariel Constenla-Haile wrote: Sure you google and found different ways of embedding a text graphic object. The way I like the most is the following: instead of setting the GraphicURL property http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextGraphicObject.html#GraphicURL set the Graphic property http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextGraphicObject.html#Graphic Just replace in this example the property name and the object reference http://svn.services.openoffice.org/opengrok/xref/DEV300_m42/odk/examples/java/Text/GraphicsInserter.java#155 this example is for Writer of course. If you want a generic solution, use a com.sun.star.drawing.GraphicObjectShape http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/GraphicObjectShape.html In this case, also set the css.graphic.XGraphic instead of the GraphicURL http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/GraphicObjectShape.html#Graphic (do not follow the old work-around described in http://codesnippets.services.openoffice.org/Calc/Calc.InsertGfx.snip ...mmm this must be updated). Regards -- Ariel Constenla-Haile La Plata, Argentina Aus der Kriegsschule des Lebens - Was mich nicht umbringt, macht mich härter. Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org in this way, can the user now be able to remove the image from the document if she wishes to, in the UI? i need the image to be treated the same as when it is inserted in the normal manner. you know, you can move it around the document, resize it anytime, and delete it as well (using backspace or delete from the keyboard). - What cannot kill you will make you stronger. -- View this message in context: http://www.nabble.com/embedding-an-image-to-open-office-documents-tp22386730p22397303.html Sent from the openoffice - api dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] embedding an image to open office documents
Hello allirpa, On Sunday 08 March 2009, 10:03, allirpa wrote: in this way, can the user now be able to remove the image from the document if she wishes to, in the UI? technically, it should (though in parctice, one never knows how the implementation works, unless you study how things are implemented - but API clients shouldn't worry about that). If you wnat to be sure, make your own test: * insert the embedded image using API * store and close the document * open it again, remove the image; store and close the document again * change the document extension to *.zip * unzip that file and see if the picture is still there. If so, this is an issue. Regards -- Ariel Constenla-Haile La Plata, Argentina Aus der Kriegsschule des Lebens - Was mich nicht umbringt, macht mich härter. Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] embedding an image to open office documents
Ariel Constenla-Haile wrote: Hello allirpa, On Sunday 08 March 2009, 10:03, allirpa wrote: in this way, can the user now be able to remove the image from the document if she wishes to, in the UI? technically, it should (though in parctice, one never knows how the implementation works, unless you study how things are implemented - but API clients shouldn't worry about that). If you wnat to be sure, make your own test: * insert the embedded image using API * store and close the document * open it again, remove the image; store and close the document again * change the document extension to *.zip * unzip that file and see if the picture is still there. If so, this is an issue. Regards -- Ariel Constenla-Haile La Plata, Argentina Aus der Kriegsschule des Lebens - Was mich nicht umbringt, macht mich härter. Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org Good day Ariel! I'm happy to tell you that i am now able to insert images in my document! Thanks to you! Thank you very much! Till next time. :) - What cannot kill you will make you stronger. -- View this message in context: http://www.nabble.com/embedding-an-image-to-open-office-documents-tp22386730p22406221.html Sent from the openoffice - api dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] embedding an image to open office documents
Hello allirpa, On Saturday 07 March 2009, 09:34, allirpa wrote: help. i need to embed an image to an open office document. how can this be done? do you just want to embed it, or also display it in a document. If only the first, there is the embed API that lets you embed any kind of content http://api.openoffice.org/docs/common/ref/com/sun/star/embed/module-ix.html If you want to insert an image without linking it, but instead emebdding it, then that's another story (already answered here and on the OOo forums - just google it). if you want more details, explain a little more what you want to achive (for a vague question there can only be a vague answer) Regards -- Ariel Constenla-Haile La Plata, Argentina Aus der Kriegsschule des Lebens - Was mich nicht umbringt, macht mich härter. Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] embedding an image to open office documents
Ariel Constenla-Haile wrote: Hello allirpa, On Saturday 07 March 2009, 09:34, allirpa wrote: help. i need to embed an image to an open office document. how can this be done? do you just want to embed it, or also display it in a document. If only the first, there is the embed API that lets you embed any kind of content http://api.openoffice.org/docs/common/ref/com/sun/star/embed/module-ix.html If you want to insert an image without linking it, but instead emebdding it, then that's another story (already answered here and on the OOo forums - just google it). if you want more details, explain a little more what you want to achive (for a vague question there can only be a vague answer) Regards -- Ariel Constenla-Haile La Plata, Argentina Aus der Kriegsschule des Lebens - Was mich nicht umbringt, macht mich härter. Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org yeah. i want to insert and display it to the document. btw, thanks for the reply. :) -- View this message in context: http://www.nabble.com/embedding-an-image-to-open-office-documents-tp22386730p22386884.html Sent from the openoffice - api dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] embedding an image to open office documents
Ariel Constenla-Haile wrote: Hello allirpa, On Saturday 07 March 2009, 09:34, allirpa wrote: help. i need to embed an image to an open office document. how can this be done? do you just want to embed it, or also display it in a document. If only the first, there is the embed API that lets you embed any kind of content http://api.openoffice.org/docs/common/ref/com/sun/star/embed/module-ix.html If you want to insert an image without linking it, but instead emebdding it, then that's another story (already answered here and on the OOo forums - just google it). if you want more details, explain a little more what you want to achive (for a vague question there can only be a vague answer) Regards -- Ariel Constenla-Haile La Plata, Argentina Aus der Kriegsschule des Lebens - Was mich nicht umbringt, macht mich härter. Nietzsche Götzendämmerung, Sprüche und Pfeile, 8. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org by the way, what's the difference if the image is embedded or displayed? -- View this message in context: http://www.nabble.com/embedding-an-image-to-open-office-documents-tp22386730p22386970.html Sent from the openoffice - api dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org