Hi,
I have iterated the forum to find a solution to my problem without success.
I work in C++ but if your solution is on another language it's not a problem the API is very close.
My problem is that I'm exporting the text and images of a document (.odt/.docx) to JSON, but I'm having a problem with the position of the images (xshape/png).
When the anchor is AT_PAGE, “HoriOrientPosition” and “VertOrientPosition” contain the shape coordinates related to the page.
> That's great, that's exactly what I need!
But there are other cases, and for the moment I've concentrated on the default anchor “AT_CHARACTER”.
When I read the position, the result is linked to the anchor.
So, using XTextContentI, I can call getAnchor.
https://api.libreoffice.org/docs/idl/re ... 4483a877d3
I can get "the text range to which the content is attached."
Using XTextRange interface and XTextViewCursor
I can create a cursor and move it to the start of the xshape.
I can call getPosition and it's supposed to return “the coordinates of the cursor relative to the top left position of the first page of the document”. But the value is too small
>> What did I miss <<.
I tried another approach, I changed the anchor type to AT_PAGE, the position values after the anchor change remain the same, so the xshape is no longer located in the same place (jump to the top of the page).
>> How can I do the same thing as when in the user interface I change the anchor type from AT_CHARACTER to AT_PAGE, the xshape stays in the same place and the position is the one I need. <<
> I searched the source code but couldn't find the location of this operation.
Thanks for your help
I have iterated the forum to find a solution to my problem without success.
I work in C++ but if your solution is on another language it's not a problem the API is very close.
My problem is that I'm exporting the text and images of a document (.odt/.docx) to JSON, but I'm having a problem with the position of the images (xshape/png).
When the anchor is AT_PAGE, “HoriOrientPosition” and “VertOrientPosition” contain the shape coordinates related to the page.
> That's great, that's exactly what I need!
But there are other cases, and for the moment I've concentrated on the default anchor “AT_CHARACTER”.
When I read the position, the result is linked to the anchor.
So, using XTextContentI, I can call getAnchor.
https://api.libreoffice.org/docs/idl/re ... 4483a877d3
I can get "the text range to which the content is attached."
Using XTextRange interface and XTextViewCursor
I can create a cursor and move it to the start of the xshape.
I can call getPosition and it's supposed to return “the coordinates of the cursor relative to the top left position of the first page of the document”. But the value is too small
>> What did I miss <<.
I tried another approach, I changed the anchor type to AT_PAGE, the position values after the anchor change remain the same, so the xshape is no longer located in the same place (jump to the top of the page).
>> How can I do the same thing as when in the user interface I change the anchor type from AT_CHARACTER to AT_PAGE, the xshape stays in the same place and the position is the one I need. <<
> I searched the source code but couldn't find the location of this operation.
Thanks for your help
Statistics: Posted by wcdr — Fri Nov 29, 2024 6:03 pm