Hallo,

the following example inserts string in two cells in one row. It works
perfectly when I have simple table (devguide terminology), but it
doesn't work when I have complex table.

public void insertString( Object xCell, String sText )
{
    XText xText = ( XText ) UnoRuntime.queryInterface( XText.class, xCell );
    XTextCursor xTextCursor = xText.createTextCursor();

    xText.insertString( xTextCursor, sText, false );
}

public void fillTable()
{
...
XTextTableCursor xCursor = xTable.createCursorByCellName( "A1" );
Object xCell = xTable.getCellByName( xCursor.getRangeName() );
insertString( xCell, "ABC" );
xCursor.goRight( ( short ) 1, false );
xCell = xTable.getCellByName( xCursor.getRangeName() );
insertString( xCell, "DEF" );
...
}

My table has four columns and one row (call it ST as Simple Table).
Merge first two cells (call this new table CT as Complex Table).

 CT.A1 contains cell from ST.A1, ST.B1
 CT.B1 contains cell ST.C1
 CT.C1 contains cell ST.D1

When I run this example with simple table, ST.A1 contains "ABC" and
ST.B1 contains "DEF". When I run this example with complex table,
CT.A1 contains "ABC" and "DEF", which is below "ABC". I expect "DEF"
in CT.B1, which is former ST.C1.

If I don't use XTextTableCursor and call xTable.getCellByName( "A1" ),
xTable.getCellByName( "B1" ), same results. Doesn't work.

I double checked cell names. 1) Devguide - cell name is correct, 2)
Writer - cell name is displayed in status bar. Any idea what can be
wrong?

My OpenOffice.org version is 2.3.1.

Regards,
-- 
Robert Vojta

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

Reply via email to