Thaks Peter,

Peter Eberlein <pet.ebe <at> refofd.verwalt-berlin.de> writes:


> 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)

I started from here and after several try & error I ended up in the shorter 
form:

    view_cursor.gotoRange(src.Text, False)
    txt = controller.getTransferable()
    view_cursor.gotoRange(dst.Text, False)

    controller.insertTransferable(txt)

that seems to work correctly. I realized thought that is slower that copying
just the text and for that reason I also gave a try to dispatcher:

    view_cursor.gotoRange(src.Text, False)
    dispatcher.executeDispatch(frame, '.uno:EntireRow', '', 0, tuple())
    dispatcher.executeDispatch(frame, '.uno:Copy', '', 0, tuple())
    view_cursor.gotoRange(dst.Text, False)
    dispatcher.executeDispatch(frame, '.uno:Paste', '', 0, tuple())

But this doesn't work (unless I made some more mistakes) in headless mode.

So I will stick to copy/paste of single cell.

thanks for your time

sandro
*:-)





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to