Note that I have not tried anything that I am about to suggest :-)

1. Insert the new row where you desire it to be.

2. Use the view cursor to select the row that you desire to duplicate.

3. Use a dispatch to copy row to the clipboard.

4. Move the view cursor to the new position and use a dispatch to paste the row into the new row.

Note: This will likely fail with a complex table and special care is required for complex content (such as when a cell contains multiple text objects; for example, an embedded image).

I think that new provisions may exist for copying text content. If that is the case, you may be able to copy the text content in each cell to the new cell in the new row.




On 12/28/2010 11:36 AM, Sandro wrote:
Hi,
I already spent many hours on this problem and I can't find the correct
approach.  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.

This is the last step of a Python template system that uses openoffice
(http://oootemplate.argolinux.org). I access the document via 'uno'
interface in Python but any language would do to explain the logic behind
it.

thanks in advance


sandro
*:-)


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


--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php


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

Reply via email to