Issue 103669 - Calling setString twice on bookmark's text range deletes adjacent bookmark
Summary: Calling setString twice on bookmark's text range deletes adjacent bookmark
Alias: None
Product: Writer
Classification: Application
Component: editing (show other issues)
Version: OOo 3.1
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2009-07-20 16:45 UTC by Daniel Benkmann
Modified: 2017-05-20 11:15 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

test document containing two bookmarks (8.14 KB, application/vnd.oasis.opendocument.text)
2009-07-20 16:47 UTC, Daniel Benkmann
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Daniel Benkmann 2009-07-20 16:45:51 UTC
The writer document setStringDeletesBookmark.odt (attached below) contains two
bookmarks. One called 'bookmark1' on the text "abc", the other called
'bookmark2' behind "abc". This is how it looks in the content.xml:

<text:bookmark-start text:name="bookmark1"/>abc<text:bookmark-end
text:name="bookmark1"/><text:bookmark text:name="bookmark2"/>

Calling the setString() function twice on bookmark1's text range deletes
bookmark2. This can be tested by executing the following macro (also included in
the document):

Sub Main
  bookmark1 = ThisComponent.getBookmarks().getByName("bookmark1")
  range = bookmark1.getAnchor()
  range.setString("bar") 'Now bookmark2 is deleted!
End Sub
Comment 1 Daniel Benkmann 2009-07-20 16:47:28 UTC
Created attachment 63654 [details]
test document containing two bookmarks
Comment 2 eric.savary 2009-07-20 16:51:27 UTC
Comment 3 michael.ruess 2009-07-21 09:13:58 UTC
MRU->OS: setString deletes the bookmark at the end of the text. On the first
execution of setString, the bookmark moves to the beginning of the text, the
second one deletes it completely.
I have also noticed that something like this happens when doing this manually
without a macro.
Comment 4 Marcus 2017-05-20 11:15:29 UTC
Reset assigne to the default "".