From 81676b0de91cca7aba897ecd3108f9eb5662a382 Mon Sep 17 00:00:00 2001 From: Alexander Roth Date: Sun, 2 Dec 2018 06:36:14 +0100 Subject: [PATCH 1/2] Added the uno patch to sys.path such that uno can load on Ubuntu Also enabled macros by default and added the option that the user can pass extra arguments to _open_url --- pyoo.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pyoo.py b/pyoo.py index 23e3e6b..40095e1 100644 --- a/pyoo.py +++ b/pyoo.py @@ -14,6 +14,8 @@ import os import sys +import sys +sys.path.append('/usr/lib/python3/dist-packages/') import uno @@ -1829,11 +1831,14 @@ def create_spreadsheet(self): document = self._open_url(url) return SpreadsheetDocument(document) - def open_spreadsheet(self, path, as_template=False): + def open_spreadsheet(self, path, as_template=False, extra = ()): """ Opens an exiting spreadsheet document on the local file system. - """ - extra = () + """ + pv = uno.createUnoStruct('com.sun.star.beans.PropertyValue') + pv.Name = 'MacroExecutionMode' + pv.Value = 4 + extra += (pv,) if as_template: pv = uno.createUnoStruct('com.sun.star.beans.PropertyValue') pv.Name = 'AsTemplate' From 7e2c21e445e4d620bfa61010c59ea571a8998851 Mon Sep 17 00:00:00 2001 From: Alexander Roth Date: Sat, 27 Apr 2019 17:20:28 +0200 Subject: [PATCH 2/2] Insert the path of the debian packe python3-uno FIRST of the path. --- pyoo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyoo.py b/pyoo.py index 40095e1..25c74a5 100644 --- a/pyoo.py +++ b/pyoo.py @@ -15,7 +15,7 @@ import sys import sys -sys.path.append('/usr/lib/python3/dist-packages/') +sys.path.insert(0,'/usr/lib/python3/dist-packages/') import uno