Apache OpenOffice (AOO) Bugzilla – Issue 31627
cannot setvalue through calc function when target cell is on same sheet as function
Last modified: 2013-02-24 21:10:03 UTC
Hi, I think my problem sounds silly. My function, schicht_type, is called by a cell on sheet 0: FUNCTION schicht_type(pointer AS INTEGER, enable AS INTEGER) AS DOUBLE Dim sheet AS OBJECT MyDoc = ThisComponent sheet = MyDoc.getSheets().getByIndex(0) sheet.getCellByPosition(0,40).setValue(23.0) END FUNCTION this function is called by a cell on sheet 0 =SCHICHT_TYPE(F64;F51) everything works, but not these 2 rows sheet = MyDoc.getSheets().getByIndex(0) sheet.getCellByPosition(0,40).setValue(23.0) if I change them sheet = MyDoc.getSheets().getByIndex(1) sheet.getCellByPosition(0,40).setValue(23.0) everything is ok I also tried to change the .getByIndex(0) to .getByName("Tabelle1") but it was the same. I'm using the german version of OOo 1.1.1 I hope I'm not telling rubbish, but checked several forums etc. Thanks a lot Dirk-Uwe
Hi Christoph, could you have a look please ? Frank
cn->nn: I've attached a bugdoc. This doc contains a small macro. If you call the function myfunc with parameter 0;0;9 (sheet_index; col; row) on sheet 0 I expect to see the value 10 on cell 0;9 of sheet 0. But nothig happens. If you call the function with parameter (1;0;9) you will see the value 10 on sheet 1 in cell 0;9.
Created attachment 16646 [details] bugdoc
That's on purpose. A function that is used in a cell formula may be called during repaint of the sheet, to get the formula's result, and cannot modify that sheet. If you want to modify cells, don't call the function from a formula.
Closing.