Hi Knut,

first I would suggest to use only ONE bookmark with dimension (!=0)
that spanns over the complete inserted content instead of using TWO
different bookmarks for the START and END-Position. If you decide to
"switch" to a single bookmark with dimension, the following code
should work:

Sub insertToBM
 Dok = ThisComponent
 range = Dok.Text.End

 ' set the "string" <> at the desired insert position
 range.setString("<>")

 ' now create a Bookmark that spanns over the Text "<>"
 Bookmark = Dok.createInstance("com.sun.star.text.Bookmark")
 Bookmark.Name = "NyttDok"
 Dok.Text.insertTextContent(range, Bookmark, true )

 ' create an "insert"-Cursor located between "<" and ">"
 insCursor = Dok.Text.createTextCursorByRange(range.Start)
 insCursor.goRight(1, false)

 ' insert the content
 'insCursor.setString("Hallo") 'test-insert instead of insertDocumentFromURL
 insCursor.insertDocumentFromURL( ConvertToURL(KSMal3$), Array() )

 ' remove char "<"
 removeCursor = Dok.Text.createTextCursorByRange(range.Start)
 removeCursor.goRight(1, false)
 removeCursor.goLeft(1, true) ' to delete a content marked from
 removeCursor.setString("")   ' right to left doesn't harm the bookmark
 ' remove char ">"
 removeCursor = Dok.Text.createTextCursorByRange(range.End)
 removeCursor.goLeft(1, false)
 removeCursor.goRight(1, true)
 removeCursor.setString("")
End Sub

regards,
Christoph

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to