I would like to be able to close an Open Office [writer] doc protected, as in the gui selection file>properties>security>open file read-only, only from a macro.
At the moment as a workround I use SetAttr. However this makes a hard coded Read Only, as in the [windows] properties box. I really only wanted a simple status setting, reversible when opening the document afterwards.
I was experimenting with args(N).Name="ReadOnly", args(N).Value="True" but this is more or less guesswork as there doesn't SEEM to be a more appropriate tag in the documentation.
Do any of the experts have a clue for me?
For the avoidance of doubt, experimental working code follows
Code: Select all
REM ***** BASIC *****
Sub Main
saveAndClose("TEST", "outlook", "abracadabra")
End Sub
sub saveAndClose (sysInstance as string, basicLibrary as string, basicModule as string)
Dim storeAsUrl As String
Dim storeToUrl As String
dim whereToStore as string
whereToStore = sysInstance & "/" & basicLibrary & "/" & basicModule
' store as C:/Users/Public/Bookkeeping/LIVE/forexCharts/basicLibrary/basicModule.odt
Dim args_ODS(0) As New com.sun.star.beans.PropertyValue
' dim args_ODS(1) as new com.sun.star.beans.PropertyValue
storeAsUrl = "file:///C:/Users/Public/Bookkeeping/" & whereToStore & ".odt"
args_ODS(0).Name = "Overwrite"
args_ODS(0).Value = True
' args_ODS(1).Name = "ReadOnly"
' args_ODS(1).Value = "True"
ThisComponent.storeAsURL(storeAsUrl, args_ODS())
SetAttr(storeAsUrl,1)
ThisComponent.close(true)
End Sub
David