Handling Array Formulas

From Apache OpenOffice Wiki
Jump to: navigation, search

The interface com.sun.star.sheet.XArrayFormulaRange handles array formulas.

  • If the whole cell range contains an array formula, the method getArrayFormula() returns the formula string, otherwise an empty string is returned.
  • The method setArrayFormula() sets an array formula to the complete cell range.
  // --- Array formulas ---
  com.sun.star.sheet.XArrayFormulaRange xArrayFormula = (com.sun.star.sheet.XArrayFormulaRange)
      UnoRuntime.queryInterface(com.sun.star.sheet.XArrayFormulaRange.class, xCellRange);
  // Insert a 3x3 unit matrix.
  System.out.println("Array formula is: " + xArrayFormula.getArrayFormula());
Documentation caution.png Due to a bug, this interface does not work correctly in the current implementation. The getArrayFormula() method returns the translated function names, but not the English names. The setArrayFormula() method accepts English names without preceding equal sign and without curly braces. This is inconsistent to the methods setFormula() and getFormula() of the interface com.sun.star.table.XCell. The latter can be used in order to read the English array formula from one of the used cells.
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages