In my macro I open file by
oDocPrice = StarDesktop.loadComponentFromURL(“file:///” & WorkDir & “Price.ods”, “_hidden”, 0, Dummy()).
How to change this line to open file as “ReadOnly”? I have read Pitonyak’s book but couldn’t find clear answer.
Sorry for this stupid question.
Workaround tips:
- Open it as a Template. Then the User can not resave the accidentally modified file by one click.
- Use Sheet protection.
- Save the document with Password.
Sub TestReadOnly
Dim args(0) as new com.sun.star.beans.PropertyValue
args(0).Name="ReadOnly"
args(0).Value=True
StarDesktop.loadComponentFromURL(ConvertToUrl("C:\Temp\Test.ods"), "_blank", 0, args())
End Sub
Большое спасибо
Good luck!