I develop a small program with calc and writer and for some insruction i use UNO, but even if i use myDoc.lockControllers() and myDoc.addActionLock() my document move while the execution of the macro, i don't like this and i think this increase the time execution of the macro, expecially with LibreOffice, my macro work on both OpenOffice and LibreOffice and the macro take 2x more time to execute in Libro compared to Oo. I want to know if there are equivalent of these UNO instructions in API functions.
Code: Select all
' Here i open a new writer document from a model in hidden mode
opts(0).Name = "Hidden"
opts(0).Value = True
Url = ConvertToURL("C:\test\")
fn = "modele.ott"
oDoc = StarDesktop.loadComponentFromURL(Url & fn,"_blank",0,opts())
oDoc.storeAsUrl(Url & fn,Array()) 'Will overwrite existing file without warning!
publi= oDoc.CurrentController.Frame
' Here i go to a row of a sheet for hide it
args2(0).Name = "ToPoint"
args2(0).Value ="$"+NomFeuille+".$A$"+x
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
dispatcher.executeDispatch(document, ".uno:HideRow", "", 0, Array())
'here i select a range of cells for copy it in the clipboard
args1(0).Name = "ToPoint"
args1(0).Value = "$"+NomFeuille+".$A$1:$"+NomFeuille+".$C$"+x
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
'Here i paste data previously copied on html format in the writer document
args3(0).Name = "SelectedFormat"
args3(0).Value = 51
dispatcher.executeDispatch(publi, ".uno:ClipboardFormatItems", "", 0, args3())
dispatcher.executeDispatch(publi, ".uno:Save", "", 0, Array())
oDoc.close(true)