[Solved] Check if document is opened in readonly mode

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
MATT.B
Posts: 165
Joined: Tue Nov 18, 2014 2:16 am

[Solved] Check if document is opened in readonly mode

Post by MATT.B »

some times when i open a spreadsheet it opens in read only mode. the reason it opens this way is beacuse either its already opened on another computer, the files read only flag is set by windows or it was opened from a web page ie. my email. now because this is a common thing i have created a simple script to just save a temp version of the file when opened but this is done with every spreadsheet file i open. what im looking to do is use something like getpropertyvalue() to see if the document has been opened in read only but i cant seam to figure out the syntax for this.
ive tried
thisComponent.getDocumentProperties().getPropertyByName("ReadOnly") with error
and ive tried ThisComponent.getPropertyByName("ReadOnly") but this always returns a false value
i know i'm doing something wrong just don't know what
Last edited by MATT.B on Wed Jan 31, 2018 12:48 am, edited 1 time in total.
OpenOffice 4.1.1 ON WINDOWS 7 64
MATT.B
Posts: 165
Joined: Tue Nov 18, 2014 2:16 am

Re: Check if document is opened in readonly mode

Post by MATT.B »

The beat way to describe what im trying to do is. Detect if opened document is read only if it is save file to this location with this file name. Ihave solved the save file step i just cant figure out how to detect if the file is read only
OpenOffice 4.1.1 ON WINDOWS 7 64
MATT.B
Posts: 165
Joined: Tue Nov 18, 2014 2:16 am

Re: Check if document is opened in readonly mode

Post by MATT.B »

i was doing this wrong infact im suprised at how simple my solution was

Code: Select all

dim ReadOnly
ReadOnly = ThisComponent.IsReadOnly()
this will return a true or false value
OpenOffice 4.1.1 ON WINDOWS 7 64
Post Reply