Page 1 of 1

Problems with macros when functions are present in cells

Posted: Wed Mar 19, 2008 7:28 pm
by rutimike
We have to manage a spreadsheet that has a list box form included.

In the spreadsheet there are several cells that contain functions (that return values).

The event associated to the list box is a macro that adds some rows to the existing sheet.

We have verified that this macro doesn't work because of the presence of the functions (if we cancel the functions the macro works well).


Can someone help us? If you need more details please ask.

Thank you for help.
Michela e Roberto

Re: Problems with macros when functions are present in cells

Posted: Wed Mar 19, 2008 7:42 pm
by Villeroy
Use interface c.s.s.sheet.XCalculatable to turn off automatic calculation, let the form controls do whatever they are intended to do before you recalculate.

Re: Problems with macros when functions are present in cells

Posted: Thu Mar 20, 2008 12:51 pm
by rutimike
Thanks Villeroy
we have already done this ...
we used:
before starting
ThisComponent.enableAutomaticCalculation(false)
and then (when the process is finished)
ThisComponent.enableAutomaticCalculation(true)

is it the same as
com.sun.star.sheet.XCalculatable?
or we have to write another instruction?

Re: Problems with macros when functions are present in cells

Posted: Thu Mar 20, 2008 2:12 pm
by Villeroy
is it the same as
com.sun.star.sheet.XCalculatable?
or we have to write another instruction?
An interface can be seen as a bundle of methods.
Reference on c.s.s.XCalculatable wrote: Methods' Summary
calculate recalculates all dirty cells.
calculateAll recalculates all cells.
isAutomaticCalculationEnabled returns whether automatic calculation is enabled.
enableAutomaticCalculation enables automatic calculation.
http://api.openoffice.org/docs/common/r ... table.html