Hi Pedro,
Pedro wrote:
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
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
It seems that Writer's implementation of XShape::getPosition has a bug
which occurs with your document.
Can you please submit a corresponding issue?
BTW, XShape::getPosition() at a shape in Writer shall return the
position of this shape relative to its anchor. It is not the absolute
position of the shape on the text document's page.
Thanks, Oliver.
--
=======================================================================
Sun Microsystems GmbH Oliver-Rainer Wittmann
Nagelsweg 55 Software Engineer - OpenOffice.org/StarOffice
20097 Hamburg
Germany Fax: (+49 40) 23 646 955
http://www.sun.de mailto:[email protected]
-----------------------------------------------------------------------
Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB 161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering
=======================================================================
Oliver-Rainer Wittmann (od) - OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]