From d57e44c92517304df4315a853f37078e5888a5e6 Mon Sep 17 00:00:00 2001 From: tsingletonacic Date: Mon, 1 Apr 2019 12:02:08 +0200 Subject: [PATCH] Update pyoo.py Add read only option to open_spreadsheet() --- pyoo.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyoo.py b/pyoo.py index 23e3e6b..1b53dd3 100644 --- a/pyoo.py +++ b/pyoo.py @@ -1829,7 +1829,7 @@ 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, read_only=False): """ Opens an exiting spreadsheet document on the local file system. """ @@ -1839,6 +1839,11 @@ def open_spreadsheet(self, path, as_template=False): pv.Name = 'AsTemplate' pv.Value = True extra += (pv,) + if read_only: + pv = uno.createUnoStruct('com.sun.star.beans.PropertyValue') + pv.Name = 'ReadOnly' + pv.Value = True + extra += (pv,) # UNO requires absolute paths url = uno.systemPathToFileUrl(os.path.abspath(path)) document = self._open_url(url, extra)