Unfortunately I did not cut and paste the code from the actual code,
but here is some code copied and pasted from the actual program. And
the bookmark comes _after_ the inserted text.

dispatcher.executeDispatch(Dok.CurrentController.Frame,
".uno:InsertPagebreak", "", 0, Array())

Cursor.gotoEnd( false )
Bookmark = Dok.createInstance("com.sun.star.text.Bookmark")
Bookmark.Name = "NyttDok"
Dok.Text.insertTextContent( Cursor, Bookmark, False )

Cursor.gotoEnd( false )
Cursor.collapseToEnd()
Cursor.goRight(1, false)

Cursor.insertDocumentFromURL( ConvertToURL(KSMal3$), Array() )



On 6/14/06, Stephan Wunderlich <[EMAIL PROTECTED]> wrote:
Hi Knut,

> Then Later I do:
> Cursor.gotoRange(
> ThisComponent.bookmarks.getByName("START").getAnchor(), False)
> Cursor.gotoRange( ThisComponent.bookmarks.getByName("END").getAnchor(),
> True)
> Cursor.setString("") ' Here goes my bookmarks! How can I keep them?

your cursor spans from the beginning of the bookmark "Start" to the
beginning of the bookmark "End" ... so I'd expect your code to delete
the first bookmark and keep the second untouched.

To circumvent this you could move the cursor one to the right after
moving it to "bookmarks.getByName("START").getAnchor()" by adding the line

Cursor.goRight(1,false)

This way the cursor spans from one character behind the first bookmark
to the beginning of the second and so both bookmarks should be preserved.

> Cursor.gotoRange(
> ThisComponent.bookmarks.getByName("START").getAnchor(), False)
> Cursor.insertDocumentFromURL(SomeURL, Array())
>
> REM then the bookmark is moved to the end, and I'm not able to track
> where I started.

Here you place the cursor at the beginning of the bookmark "Start" and
insert your document there ... this way the document is inserted
_before_ the bookmark "Start" ... again the line above should enable you
to move the cursor behind the bookmark "Start" and so solve your problem.

Hope that helps

Regards

Stephan

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




--
Knut Olav Bøhmer

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

Reply via email to