I want to open an .xlsx file using LibreOffice. But when I specify "ReadOnly" argument to loadComponentFromURL I get com.sun.star.lang.IllegalArgumentException
Error: 0x800405E9 from "automation bridge".
I need to use ReadOnly mode to avoid the popup that is shown each time the file is locked by other process.
Here is my code.
Code: Select all
serviceManager := ComObjCreate("com.sun.star.ServiceManager")
desktop := serviceManager.createInstance("com.sun.star.frame.Desktop")
anArray := ComObjArray(VT_VARIANT, 2)
anArray[0] := MakePropertyValue(serviceManager, "Hidden", VT_BOOL, True)
anArray[1] := MakePropertyValue(serviceManager, "ReadOnly", VT_BOOL, True)
document := desktop.loadComponentFromURL("file:///" . destPath, "_blank", 0, anArray)
sheet := document.getSheets().getByName("Sheet1")
Anybody here managed to run loadComponentFromURL with ReadOnly=True ? Any ideas?
Thanks!
[Mod edit: Topic name added]