Hello,
I have got some problems using the TableColumnSeparators-property of a
SwXTextTableRow-instance. I'm not sure if this could be a bug, so I try
to explain my issue here:

I'm trying to generate a few TextTables in an OO-Writer-Document and to
populate these tables with some computed data.
Using PyUNO and the OO-DevelopersGuide, so far I have succeeded in

- creating the necessary tables
- inserting the number of rows I need.
- inserting the number of columns into the individual rows.
  (Because each row needs to have a different row-count,
  I iterate through the cells of my table using a
  <com.sun.star.text.XTextTableCursor> and then create the columns
  in each row using splitRange().)
- inserting text into the cells of my generated table.

So far, everything looks fine. Unfortunately it seems not easy to change
the width of the table-columns of the individual table-rows. In theory,
all I need to do should be:

1. get a single row of my table as an
   <com.sun.star.text.TextTableRow>-instance.
2. reading the TableColumnSeparators-property of my table-row
3. setting the Position-properties accordingly.
4. writing-back the modified separators to
   <com.sun.star.text.TextTableRow>.TableColumnSeparators

My source-Code (I am using Python and PyUNO) looks similar to:

...
# myTable is my <com.sun.star.text.XTextTable>-instance
#
# get the row-Object
myRow = myTable.Rows.getByIndex (2)
# access the separators
seps = myRow.TableColumnSeparators
# modify the position of the last separator
seps [-1].Position = <some new value>
# write back the modified separators
myRow.TableColumnSeparators = seps

The surprising fact is that when I assign to myRow.TableColumnSeparators
for the first time, everything seems to be all right.
But subsequent assignments to myRow.TableColumnSeparators have strange
effects. (Table-rows are shifting into "nowhere" etc.)
The behaviour is just the same even if I repeat to assign identical
values to "myRow.TableColumnSeparators" several times.

I'll try to explain the observed behaviour by another code snippet:
...
# access the separators
seps = myRow.TableColumnSeparators
# modify the width of the last column of my row
newValue = <someNewValue>
seps [-1].Position = newValue
myRow.TableColumnSeparators = seps
# checking if everything is all right.
newSeps = myRow.TableColumnSeparators
# This assertion will fail in most cases, cause OpenOffice seems to
# modify the values written-back to TableColumnSeparators!
# I definitely don't know why!"
assert newSeps [-1].Position == newValue, "I thought, I did write back
newValue!"
# if I repeat the TableColumnSeparators-assignment made above,
# the table-row gets damaged
myRow.TableColumnSeparators = seps # Now column-widths are "scrambled" :-(


- I am sure to set the Position-values correctly.
  (i. e. relative to <com.sun.star.text.TextTable>.TableColumnRelativeSum)
- I tested several OpenOffice-Releases (including 2.0.2).
- searching the web didn't help either

Perhaps someone can tell me what I'm doing wrong.
Any help is greatly appreciated.

Thanks a lot.
Thomas Runge
SEG GmbH & Co. KG

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to