Difference between revisions of "Documentation/DevGuide/Spreadsheets/Handling Array Formulas"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial author Sun Microsystems, Inc.)
 
Line 22: Line 22:
 
   System.out.println("Array formula is: " + xArrayFormula.getArrayFormula());  
 
   System.out.println("Array formula is: " + xArrayFormula.getArrayFormula());  
  
{{Documentation/Caution|Due to a bug, this interface does not work correctly in the current implementation. The method accepts the translated function names, but not the English names. This is inconsistent to the method <tt>setFormula()</tt> of the interface <idl>com.sun.star.table.XCell</idl>.}}
+
{{Documentation/Caution|Due to a bug, this interface does not work correctly in the current implementation. The <tt>getArrayFormula()</tt> method returns the translated function names, but not the English names. The <tt>setArrayFormula()</tt> method accepts English names without preceding equal sign and without curly braces. This is inconsistent to the methods <tt>setFormula()</tt> and <tt>getFormula()</tt> of the interface <idl>com.sun.star.table.XCell</idl>. The latter can be used in order to read the English array formula from one of the used cells.}}
  
 
{{PDL1}}
 
{{PDL1}}
 
[[Category: Spreadsheet Documents]]
 
[[Category: Spreadsheet Documents]]

Revision as of 11:50, 13 November 2007



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.
 xArrayFormula.setArrayFormula("=A10:C12");
 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