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

Tor Lillqvist tml at collabora.com
Tue Apr 3 14:37:31 UTC 2018


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

New commits:
commit 6540f3f780fa200afea1e50c280a13918c7a07a1
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Mar 28 17:02:28 2018 +0300

    Add mode lines and license blurb
    
    Change-Id: Ifc319e6954665b71f8a98d6ec849a71bbf2b7318
    (cherry picked from commit 850b401ebad13d20481f3ed01990c8070a33f6f1)
    Reviewed-on: https://gerrit.libreoffice.org/52096
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Reviewed-on: https://gerrit.libreoffice.org/52319

diff --git a/scripting/examples/python/NamedRanges.py b/scripting/examples/python/NamedRanges.py
index 812cabb583e0..b699f286fc26 100644
--- a/scripting/examples/python/NamedRanges.py
+++ b/scripting/examples/python/NamedRanges.py
@@ -1,3 +1,12 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
 import traceback
 import uno
 
@@ -46,3 +55,5 @@ def DeleteNamedRange(name):
         tb = e.__traceback__
         traceback.print_tb(tb)
     return None
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
commit f7ef2421af666b4df4d82b6e897eaa9bd38c3508
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>
    Reviewed-on: https://gerrit.libreoffice.org/52318

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