Apache OpenOffice (AOO) Bugzilla – Issue 48689
The Opendocument macro in the tools library does not work properly
Last modified: 2017-05-20 11:27:40 UTC
The Opendocument macro in the tools library does not work properly, the problem I had was that I was trying to open a document using this macro function and nothing happened. when I used the debugging of the macro (added an breakpoint) it was however working properly. this was strange, however I think I have found the culprit. --- from the script --- ... If Not IsMissing(bDisposable) Then bDisposable = True End If OpenDocument() = StarDesktop.LoadComponentFromURL(DocPath,"_default",0,Args()) End Function --- end --- The problem is that StarDesktop.LoadComponentFromURL is using a deprecated value for the searchflags (0) it looks liek the flag should be set to com.sun.star.frame.FrameSearchFlag.ALL+com.sun.star.frame.FrameSearchFlag.CREATE instead of the 0 (com.sun.star.frame.FrameSearchFlag.AUTO) that it is using now.
opendocument works properly for me ... which arguments did you pass as it failed in your case ? I used ... opendocument("private:factory/sdraw",dimarray(),false) opendocument("private:factory/swriter",dimarray(),false)
the url i used was for an existing document and not a new document that you used below, so the url was of type "file:///home/user/testdocument.odt" it might have mattered also that i had abasic dialog opened at the same time (the code to load the document was triggered from the basic dialog)
I've tried to create a test document here now for this, but i cannot reproduce it with the test document, however in my sollution that I did get the error I can reproduce it. my setup is as follows. I have created my own extensions that add a menu to openoffice, clicking on one of these menu-entries I open up a dialog, when clicking on a button in this dialog an document is to be opened, this fails for me (I'm using OpenDocuemnt) using the StarDesktop.LoadComponentFromURL(DocPath,"_default",0,Args()) manually instead of calling Opendocument it still fails unless I change "_default" to "_blank" OR add the FrameSearchFlag.ALL+FrameSearchFlag.CREATE instead of the 0..
sw->bc: changing the SearchFlag to something not deprecated seems to be a good idea anyway.
accepted. started.
bc->ih: Basic macros are yours now
IH->faltrion: please tell me in detail what I have to change in the tools library, thanks.
you should probably change it from 0 to com.sun.star.frame.FrameSearchFlag.ALL+com.sun.star.frame.FrameSearchFlag.CREATE
Reset assigne to the default "issues@openoffice.apache.org".