 | OO-Snippets: Toggle automatic calculation of spreadsheetsCommons| Keywords | automatic, calculation |
|---|
| Language | ooRexx |
|---|
| Application | Calc |
|---|
| Authors | Josef Frysak (initial)
|
|---|
| Supported Versions | 2.4.1 |
|---|
| Supported OS | All |
|---|
| Question | How to activate and deactivate the automatic calculation?
|
|---|
| Answer | Every spreadsheet document also inherits an "XCalculatable" interface. This interface contains the "isAutomaticCalculationEnabled" function to get the state of the automatic calculateion and the "enableAutomaticCalculation" method to turn it on and off. For further details see http://wi.wu-wien.ac.at/rgf/diplomarbeiten/BakkStuff/2008/200809_Frysak/200809_Frysak_Automating_OOo_ooRexx_Nutshells.pdf. |
|---|
x_ScriptContext = uno.getScriptContext()
if (x_ScriptContext <> .nil) then
do
x_ComponentContext = x_ScriptContext~getComponentContext
x_Desktop = x_ScriptContext~getDesktop
x_Document = x_ScriptContext~getDocument
end
else
do
x_ComponentContext = UNO.connect()
service = "com.sun.star.frame.Desktop"
s_Desktop = x_ComponentContext~getServiceManager~XMultiServiceFactory~createInstance(service)
x_Desktop = s_Desktop~XDesktop
x_Document = x_Desktop~getCurrentComponent()
end
x_Calculatable = x_Document~XCalculatable
if x_Calculatable~isAutomaticCalculationEnabled()
then x_Calculatable~enableAutomaticCalculation(.false)
else x_Calculatable~enableAutomaticCalculation(.true)
::requires UNO.CLS
|
Changelog| Date | User | Modification |
|---|
| 2008-10-12 | 1 | Initial version |
|