Pedro escribió:
Peter Eberlein escribió:
Hi Pedro
Pedro schrieb:
Hi, i'm trying to get the positios of an image inserted into a writer document but I don't know how do it. I was trying this during a whole week, but i can't find how to do it. In the PropertySet i haven't got any property for get the position of a image.
I'm using java, my imcomplete code it's:
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...


           XNameAccess as = os.getGraphicObjects();
           String[] s = as.getElementNames();
                     //Get the first image of the document
           Object o = (Object) as.getByName(s[0]);
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

Here I have the first image, now i want to get the position in the document for this image, how I can get it? XPropertySet doesn't have any attribute for this.

The graphic object object supports the service com.sun.star.text.BaseFrame which exports the interface com.sun.star.drawing.XShape.
So query for it and you will get the method .getPosition()

Regards

Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Hi Peter, thanks for the solution, but it doesn't work. I get this error: com.sun.star.uno.RuntimeException: position cannot be determined with this method The doc it's compossed by a text line, an image and other text line. The code with your solution it's
            ... ...
           XIndexAccess ig = (XIndexAccess) UnoRuntime.queryInterface(
                   XIndexAccess.class, os.getGraphicObjects());
           XShape sh = (XShape) UnoRuntime.queryInterface(
                   com.sun.star.drawing.XShape.class, ig.getByIndex(0));
           Object oas = sh.getPosition();
         .... ....
The program crashes in getPosition method.

Regards

Hi again, i have tried sh.getPosition(); with a Draw document (*.odp) and it works fine, the problem it's with Writer documents (*.odt) I need the position in the document of the images that contains but the getPosition method doesn't work and I can find any solutions in forums, FAQ's, etc...

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to