// Changing the background color of the cell to red
xpropertyset.setPropertyValue(
"CellBackColor", new Integer( 16711680 ) );
} else {
// Querying for the interface XColumnRowRange on the XCellRange
XColumnRowRange xcolumnrowrange = ( XColumnRowRange )
UnoRuntime.queryInterface(
XColumnRowRange.class, xcellrange );
// Inserting one row to the table
XTableRows xTableRows = xcolumnrowrange.getRows();
xTableRows.insertByIndex( intRowToInsert, 1 );
// Querying for the interface XCellRangeMovement on XCellRange
XCellRangeMovement xcellrangemovement = ( XCellRangeMovement )
UnoRuntime.queryInterface( XCellRangeMovement.class, xcellrange );
// Creating the cell address of the destination
CellAddress celladdress = new CellAddress();
celladdress.Sheet = 0;
celladdress.Column = 0;
celladdress.Row = intRowToInsert;
// Creating the cell range of the source
CellRangeAddress cellrangeaddress =
new CellRangeAddress();
cellrangeaddress.Sheet = 0;
cellrangeaddress.StartColumn = 0;
cellrangeaddress.StartRow = intRow + 1;
cellrangeaddress.EndColumn = 8;
cellrangeaddress.EndRow = intRow + 1;
// Moves the cell range to another position in the document
xcellrangemovement.moveRange( celladdress, cellrangeaddress );
// Removing the row not needed anymore
xcolumnrowrange.getRows().removeByIndex( intRow + 1, 1 );
// Set the current row, because we want to recalculate all rows below
intRow = intRowToInsert - 1;
// Tests at which line we want to insert