Thanks for your answer.
I am near the solution.
- To Open the document with correct rights, I must write
vProps[2] = new PropertyValue();
vProps[2].Name = "MacroExecutionMode";
vProps[2].Value = new Short(MacroExecMode.ALWAYS_EXECUTE_NO_WARN);
and not new Integer(...).
- To execute the macro, I write :
XDispatchHelper vDipatchHelper = (XDispatchHelper)
UnoRuntime.queryInterface(XDispatchHelper.class,
OoBootstrap.createService("com.sun.star.frame.DispatchHelper"));
vDipatchHelper.executeDispatch((XDispatchProvider)
UnoRuntime.queryInterface(XDispatchProvider.class, vFrameDoc),
"vnd.sun.star.script:myMacro.keepAuto.Main?language=Basic&location=document"
, "", 0, null);
and it is ok.
I have another problem. When I load the document with property Hidden=false,
all is Ok. But when I load the document with property Hidden=true, the macro
isn't executed, and I have the message "A Scripting Framework error occurred
while running the Basic Script (...) BasicProviderImpl::getScript: no
script!".
Is it an OO bug?
Thanks,
Antoine
-----Message d'origine-----
De : Tobias Krais [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 14 décembre 2007 09:39
À : [email protected]
Objet : Re: [api-dev] Load a document and run macro
Hi Antoine,
> To load the document, I tried :
> String vUrl = "file://".concat(((File)
> pSrc).toURL().toExternalForm().substring(5));
Just a hint: the way you create the UNO compatible URL is not the best.
See this snippet:
http://codesnippets.services.openoffice.org/Office/Office.CreateUNOCompatibl
eURL.snip
to create a UNO compatible URL that is platform independent.
Greetings, Tobias
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]