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

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

> Maybe the XTransferable interface is useful in this scenario. You'll 
> find examples googling this or the api list.

thanks for the hint. I'm slowing acquiring the needed basis (yes I don't
know java and it took me some time to understand the majority of examples
that used queryInterface...).

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)
    transferrable = controller.getTransferable()
    ... here I select the new cell and insert
    controller.insertTransferable(transferrable)

this code fails in that the cell that gets selected is always 'A1' and not
the cell at position (c, index+1). How can I set the cursor so that it
encompasses the whole cell?

thanks again
sandro
*:-)


> 
> Hi Sandro
> Am 03.01.2011 12:16, schrieb Sandro:
> > Hi,
> >
> > I'm writing to the dev list after spending many days trying hard to
> > understand the best way and asking in user lists and forums.
> >
> > I really hope someone can help me or point me in the correct
> > direction/reading.
> >
> > I need to programmatically duplicate rows of a Table in openoffice writer.
> >
> > It's not difficult to add rows via table.Rows.insertByIndex(idx, count),
> > that adds empty rows and it's easy to add text in that row assigning
> > DataArray to the CellRange. Doing this way you loose control on the style of
> > the cells and specifically if a cell has words with different style
> > (bold/italic) they get flattened to the same face. What I need is to
> > duplicate a row in a way that preserves the style of each word in the
> > cell/row.
> >
> > As far as I understand using openoffice in headless mode prevents me
> > from using dispatch as no ViewCursor should be available.
> >

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