Laurent Godard wrote:

Hi,

In a text document, how can i get a XTextCursor at the current position
of the ViewCursor?

viewCursor = document.getCurrentController().getViewCursor() textCursor = document.Text.createTextCursor()

//TextCursors include the TextRange service
viewCursorRange = viewCursor.getEnd()

textCursor.gotoRange( viewCursorRange )

You may try
viewCursor = document.getCurrentController().getViewCursor()
textCursor = document.Text.createTextCursorByRange(viewCursor)

Laurent


This will work great assuming that there is only one text object in the document :-)
It might be safer to use:


viewCursor = document.getCurrentController().getViewCursor()
textCursor = viewCursor.getText().createTextCursorByRange(viewCursor)

But most people simply use the original code, which almost always works :-)

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm
Free Info:  http://www.pitonyak.org/oo.php


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



Reply via email to