Problem opening an .xlsx file via LibreOffice's COM interface

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ovidiugabriel
Posts: 9
Joined: 22 Jul 2018, 14:19

Problem opening an .xlsx file via LibreOffice's COM interface

10 Jul 2019, 10:07

Hello,

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")
Without ReadOnly attribute the code runs fine.
Anybody here managed to run loadComponentFromURL with ReadOnly=True ? Any ideas?

Thanks!

[Mod edit: Topic name added]

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, mstrauss2021, robozao and 236 guests