Exception trying to reach a bookmark

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Exception trying to reach a bookmark

Postby pierrezx » Tue May 14, 2019 8:38 am

I have already several routines that works, to manipulate word documents through the OOO Api.
But when trying to reach a bookmark to insert a bmp image at its position, I can't reach propoerty of the bookmark or property of the cursor.
The exception message indicates "End of content node doesn't have the proper start node".

I have looked a lot on the web, among dozen of pages... but noway...

For exemple, it crashes with these two versions :

- here on the fisrt line (getAnchor or .anchor functions raise the exception) :

Code: Select all   Expand viewCollapse view
  Bookmark := FDocumentOpenOffice.Bookmarks.getByName(ABookMarkName).Anchor;
  wCursor := FDocumentOpenOffice.Text.createTextCursorByRange(Bookmark);
  FDocumentOpenOffice.Text.insertTextContent(wCursor, fShape, False);

- and here on the .getstart at the third line :

Code: Select all   Expand viewCollapse view
  wViewCursor := FDocumentOpenOffice.getCurrentController.getViewCursor;
  wCursor := wText.createTextCursorByRange(wViewCursor);
  wText.insertTextContent([size=150]wCursor.getStart[/size], fShape, false);
  wText.insertTextContent(wViewCursor, fShape, false);

I will continue to look for a solution among the web... and the ooo users guide that I have already read with no success... forums, etc...
Open Office / Windows 7 / Delphi Seattle
Posts: 1
Joined: Tue May 14, 2019 8:23 am

Re: Exception trying to reach a bookmark

Postby JeJe » Tue May 14, 2019 9:24 pm

I only know Basic... but as no-one else has responded...


is exactly the same in Basic. Provided FDocumentOpenOffice is a loaded writer component and ABookMarkName is a valid bookmark I can't see how it can fail. You've only given part of the code though so maybe the problem is before that line? What are your declarations? Try commenting out the part after it and see if you still get the error...
Openoffice 4.1.6
Windows 8
Posts: 1497
Joined: Wed Mar 09, 2016 2:40 pm

Return to External Programs

Who is online

Users browsing this forum: No registered users and 2 guests