Hello,
In a java program, I want to load a writer document and then run a macro
that is inner this document (odt).
To load the document, I tried :
String vUrl = "file://".concat(((File)
pSrc).toURL().toExternalForm().substring(5));
PropertyValue vProps[] = new PropertyValue[3];
vProps[0] = new PropertyValue();
vProps[0].Name = "Hidden";
vProps[0].Value = Boolean.TRUE;
vProps[1] = new PropertyValue();
vProps[1].Name = "UpdateDocMode";
vProps[1].Value = new Short(UpdateDocMode.FULL_UPDATE);
vProps[2] = new PropertyValue();
vProps[2].Name = "MacroExecutionMode";
vProps[2].Value = new Integer(MacroExecMode.ALWAYS_EXECUTE);
Object vDocSrc = vCompLoader.loadComponentFromURL(vUrl, "_blank", 0,
vProps);
.but it seems to have rights problems.
To run the macro, I tried :
com.sun.star.util.URL[] aURL = new com.sun.star.util.URL[1];
aURL[0] = new com.sun.star.util.URL();
aURL[0].Complete =
"macro://MymacroGroup.keepAuto.Main?language=Basic&location=document";
XDispatch xDispatcher = ((XDispatchProvider)
UnoRuntime.queryInterface(XDispatchProvider.class,
vFrameDoc)).queryDispatch(aURL[0], null,
com.sun.star.frame.FrameSearchFlag.GLOBAL);
xDispatcher.dispatch(aURL[0], null);
. but it doesn't works.
Is there a good means?
Thanks,
Antoine