Re: Re: API to clone a row in a writer's table - ViewCursor positioning

Peter Eberlein <[email protected]>
Newsgroups gmane.comp.openoffice.devel.general
Message-ID <[email protected]>
Hi Sandro,

I tried it without a XTextViewCursor.
Don't know, if the XSelection interface is supported in headless mode, 
if no, then maybe someone of the writer team has an idea.

I didn't find a way to span a XTextRange over more then one cell to get 
the selection at a whole, so try the following:

You have to iterate over each cell of your row, put the sample code in a 
loop (after translating from Basic to Python):

cellSrc = thisComponent.TextTables.getByIndex(0).getCellByPosition(0,0,0,0)
cursorSrc = cellSrc.getText.createTextCursorbyRange(cellSrc.getStart)
cursorSrc.gotoEnd(true)
Thiscomponent.CurrentController.select(cursorSrc)
transferable = Thiscomponent.CurrentController.getTransferable()
cellDest= thisComponent.TextTables.getByIndex(0).getCellByPosition(0,1,0,1)
cursorDest = cellDest.getText.createTextCursorByRange(cellDest.getStart)
cursorDest.gotoEnd(true)
Thiscomponent.CurrentController.select(cursorDest)
Thiscomponent.CurrentController.insertTransferable(transferable)

Regards

Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.