[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - scripting/examples

Tor Lillqvist tml at collabora.com
Tue Apr 3 12:34:00 UTC 2018


 scripting/examples/python/NamedRanges.py |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit ca6dc501e3b888a59d2ec906010d6db2c2cda919
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Mar 28 16:52:28 2018 +0300

    Add DeleteNamedRange function
    
    Change-Id: I081614cb34aee704c9162f58c78dbaa6a350d30b
    (cherry picked from commit f21e341d0fbfb39f7d5d976f89f00f844e201576)
    Reviewed-on: https://gerrit.libreoffice.org/52095
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

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


More information about the Libreoffice-commits mailing list