summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-03-28 16:52:28 +0300
committerTor Lillqvist <tml@collabora.com>2018-03-28 16:52:46 +0300
commitf21e341d0fbfb39f7d5d976f89f00f844e201576 (patch)
tree33aab87762398b98724abd09a4a50846be93eac4 /scripting
parent7e92a996d1588bdf2ff1e2df10220a0f57686cfb (diff)
Add DeleteNamedRange function
Change-Id: I081614cb34aee704c9162f58c78dbaa6a350d30b
Diffstat (limited to 'scripting')
-rw-r--r--scripting/examples/python/NamedRanges.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripting/examples/python/NamedRanges.py b/scripting/examples/python/NamedRanges.py
index abdef141f397..812cabb583e0 100644
--- a/scripting/examples/python/NamedRanges.py
+++ b/scripting/examples/python/NamedRanges.py
@@ -35,3 +35,14 @@ def DefineNamedRange(sheet, x0, y0, width, height, name):
position.Row = 0
model.NamedRanges.addNewByName(name, content, position, 0)
return None
+
+def DeleteNamedRange(name):
+ try:
+ desktop = XSCRIPTCONTEXT.getDesktop()
+ model = desktop.getCurrentComponent()
+ model.NamedRanges.removeByName(name)
+ except Exception as e:
+ print("Caught Exception: " + str(e))
+ tb = e.__traceback__
+ traceback.print_tb(tb)
+ return None