Niklas Johansson wrote:
If I were you I would set the Anchor before I insert the image into the
document. So change the order of these lines:
xText.insertTextContent(cursor, oGraphic, False)
# Setting the anchor type - must be done first, otherwise the graphic will be put after the
//
oGraphic.AnchorType = AS_CHARACTER
YES!! That solves it. Thans a lot.
Once the image is inserted into the document you won't always be able to
change the anchor as you try to do in the code above. For some reason it
works in your first example but as you can see it won't work in your
second example.
I did is as it was done in the Java code.
So remember to always change the anchor of the graphic before you insert
it otherwise you'll get more of these nice surprises. If I remember
correctly there are a few more settings that should be done to the
graphic object before it's inserted and some that needs to be set after,
but I don't remember the details at the moment.
I hope that these things are documented somewhere.
It seems that what is happening in the second case is that the image
gets inserted before the anchor-change and when the re-anchoring occurs
the image is already in the wrong position.
--
Piet van Oostrum <piet@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.