 | OO-Snippets: How to call Java Program Using Scripting FrameworkCommons| Keywords | Scripting, Framework |
|---|
| Language | Java |
|---|
| Application | Office |
|---|
| Authors | |
|---|
| Supported Versions | 2.0.x |
|---|
| Supported OS | All |
|---|
| Question |
|
|---|
| Answer | |
|---|
XMultiComponentFactory xMultiComponentFactory = connection.getComponentContext() .getServiceManager();
Object oMSPFac =xMultiComponentFactory.createInstanceWithContext("com.sun.star.script.provider.MasterScriptProviderFactory",connection.getComponentContext() );
XScriptProviderFactory xScriptProviderFactory = (XScriptProviderFactory ) UnoRuntime.queryInterface(
XScriptProviderFactory.class, oMSPFac );
Object oMSP = xScriptProviderFactory.createScriptProvider(document );
XScriptProvider xScriptProvider = ( XScriptProvider ) UnoRuntime.queryInterface( XScriptProvider.class, oMSP);
XScript myScript = xScriptProvider.getScript("vnd.sun.star.script:HelloWorld.HelloWorld.printHW?language=Java&location=share");
String a;
a = "** Hi ***";
Object[] objectArray = { a };
short[][] s = { { 0, 0 }, { 0, 0 } };
Object nullObject;
nullObject = null;
Object[][] object0 = { { nullObject, nullObject }, {nullObject, nullObject } };
Object result = myScript.invoke( objectArray, s,object0 );
|
|