- I have OpenOffice installed in /usr/lib/openoffice (OOO_HOME)
- create a project (OpenOffice for example)
- create a class library (OpenOfficeLib for example):
- in Classpath put:
- OOO_HOME/program/classes/juh.jar
- OOO_HOME/program/classes/jurt.jar
- OOO_HOME/program/classes/ridl.jar
- OOO_HOME/program/classes/unoil.jad
- OOO_HOME/program/classes/officebean.jar
- OOO_HOME/sdk/classes
- Libraries: add OpenOfficeLib library on Compile tab
- Run:
- Main Class: com.sun.star.lib.loader.Loader
- Arguments : YOUR_MAIN_CLASS
- VM Options: -Djava.library.path="OOO_HOME/program" -Dcom.sun.star.lib.loader.unopath="OOO_HOME/program"
XComponentContext xLocalContext = Bootstrap.bootstrap();
XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager();
Object desktop = xLocalServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", xLocalContext);
XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop);
PropertyValue[] pPropValues = new PropertyValue[0];
XComponent xWriterComponent = xComponentLoader.loadComponentFromURL("private:factory/swriter", "_blank", 0, pPropValues);
- run your project with F6 and voila. You get OpenOffice Writer opened. :)
Then use the OpenOffice Developer's Guide to create something useful. :)
Ni komentarjev:
Objavite komentar