Indexed Cells and Cell Ranges

From Apache OpenOffice Wiki
Jump to: navigation, search



The interface com.sun.star.table.XCellRange provides access to cells using their row and column index as position, and to create sub ranges of tables:

 com::sun::star::table::XCell getCellByPosition( [in] long nColumn, [in] long nRow) 
 com::sun::star::table::XCellRange getCellRangeByPosition( [in] long nLeft, [in] long nTop, 
                                                           [in] long nRight, [in] long nBottom) 
 com::sun::star::table::XCellRange getCellRangeByName( [in] string aRange) 

The method getCellByPosition() returns a cell object supporting the interfaces com.sun.star.table.XCell and com.sun.star.text.XText. To find the cell the name is internally created from the position using the naming scheme described above and returns this cell if it exists. Calling getCellByPosition(1, 1) in the table at the beginning of this chapter returns the cell "B2" .

The methods getCellRangeByPosition() and getCellRangeByName() return a range object that is described below. The name of the range is created with the top-left cell and bottom-right cell of the table separated by a colon : as in A1:B4. Both methods fail when the structure of the table contains merged or split cells.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages