Data Array

From Apache OpenOffice Wiki
Jump to: navigation, search



The contents of a cell range that are stored in a 2-dimensional array of objects are set and obtained by the interface com.sun.star.sheet.XCellRangeData.

  • The method getDataArray() returns a 2-dimensional array with the contents of all cells of the range.
  • The method setDataArray() fills the data of the passed array into the cells. An empty cell is created by an empty string. The size of the array has to fit in the size of the cell range.

The following example uses the cell range xCellRange that has the size of 2 columns and 3 rows.

  // --- Cell range data ---
  com.sun.star.sheet.XCellRangeData xData = (com.sun.star.sheet.XCellRangeData)
      UnoRuntime.queryInterface(com.sun.star.sheet.XCellRangeData.class, xCellRange);
 
  Object[][] aValues =
  {
      {new Double(1.1), new Integer(10)},
      {new Double(2.2), new String("")},
      {new Double(3.3), new String("Text")}
  };
 
  xData.setDataArray(aValues);
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages