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

Sandro <[email protected]>
Newsgroups gmane.comp.openoffice.devel.general
Message-ID <[email protected]>
Answering to myself and leaving one more point.


> I almost finished but I still can't understand how to move the visible
> cursor to the correct position. What I do is:
> 
>     table.Rows.insertByIndex(index, count)
> 
>     cell = self.table.getCellByPosition(c, index+1)
>     controller.select(cell)
>     view_cursor.gotoStart(False)   # retes position of cursor to beginning
>                                    # of table
>     view_cursor.gotoEnd(True)

I see that using gotoRange works interactively (ipython + uno) but fails in the 
real situation (non interactive):

    view_cursor.gotoRange(src_cell.Text, False)
    txt = controller.getTransferable()
    view_cursor.gotoRange(dst_cell.Text, False)

    controller.insertTransferable(txt)

moreover I cannot extend the viewCursor:

In [246]: view_cursor.gotoRange(table.getCellByName('A3').Text, False)

In [247]: view_cursor.gotoRange(table.getCellByName('B3').Text, True)
---------------------------------------------------------------------------
com.sun.star.uno.RuntimeException         Traceback (most recent call last)

/home/misc/src/hg/py/oootemplate/demo/<ipython console> in <module>()

com.sun.star.uno.RuntimeException: 
> <ipython console>(1)<module>()

ipdb> 

While according to my understanding that should expand the cursor (clearly cell 
b3 *does* exist.

Am I wrong?

sandro
*:-)
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.