Problems with macros when functions are present in cells

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
rutimike
Posts: 5
Joined: Wed Mar 19, 2008 7:24 pm

Problems with macros when functions are present in cells

Post 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
User avatar
Villeroy
Volunteer
Posts: 31344
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Problems with macros when functions are present in cells

Post 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.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
rutimike
Posts: 5
Joined: Wed Mar 19, 2008 7:24 pm

Re: Problems with macros when functions are present in cells

Post 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?
User avatar
Villeroy
Volunteer
Posts: 31344
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Problems with macros when functions are present in cells

Post 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
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply