Hi Kent,
Here is the java code I use:
OfficeDocument document =
this.connection.getDocumentN();
XController controller =
document.getCurrentController();
XFrame frame = controller.getFrame();
XDispatchProvider xDispProvider = ( XDispatchProvider
) UnoRuntime.queryInterface(
XDispatchProvider.class,controller );
XURLTransformer xParser = (
com.sun.star.util.XURLTransformer )
UnoRuntime.queryInterface( XURLTransformer.class,
this.connection.getServiceFactoryN().createInstance(URL_TRANSFORMER
) );
URL[] aParseURL = new URL[1];
aParseURL[ 0 ] = new URL();
aParseURL[ 0 ].Complete = toDispatch;
xParser.parseStrict( aParseURL );
URL aURL = aParseURL[ 0 ];
XDispatch xDispatcher = xDispProvider.queryDispatch(
aURL, "", 0 ); //$NON-NLS-1$
// dispatch
if ( xDispatcher != null )
{
xDispatcher.dispatch( aURL, new PropertyValue[] { }
);
}
also no visible effect.
do you use an additional Wrapper ? ... Can't recall to have heard of a
class named OfficeDocument that comes with the office ... maybe I just
overread something :-)
Anyway ... the following java-code works like a charm for me ...
---------------------------------------------------------------
public static void main(String[] args) {
try {
XComponentContext xContext =
com.sun.star.comp.helper.Bootstrap.bootstrap();
// get the servie manager rom the office
XMultiComponentFactory xMCF = xContext.getServiceManager();
// create a new instance of the the desktop
Object oDesktop = xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop", xContext );
Object DH = xMCF.createInstanceWithContext(
"com.sun.star.frame.DispatchHelper", xContext );
XDispatchHelper xDH = (XDispatchHelper)
UnoRuntime.queryInterface(
XDispatchHelper.class, DH);
// query the desktop object for the XComponentLoader
XComponentLoader xCLoader = ( XComponentLoader )
UnoRuntime.queryInterface(
XComponentLoader.class, oDesktop );
PropertyValue LoadArgs[] = new PropertyValue []{};
XComponent xComp = xCLoader.loadComponentFromURL(
"private:factory/swriter", "_blank", 0, LoadArgs );
XModel xModel = (XModel)
UnoRuntime.queryInterface(XModel.class, xComp);
XDispatchProvider xDP = (XDispatchProvider)
UnoRuntime.queryInterface(XDispatchProvider.class,
xModel.getCurrentController().getFrame());
xDH.executeDispatch(xDP, ".uno:PrinterSetup", "", 0, LoadArgs);
} catch(Exception e){
System.err.println(" Exception " + e);
e.printStackTrace(System.err);
}
System.out.println("... done");
}
---------------------------------------------------------------
Hope that helps
Regards
Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]