open document Tobias Krais (www.design-to-use.de) How to open a document? import {%see com.sun.star.beans.PropertyValue}; import {%see com.sun.star.frame.XComponentLoader}; import {%see com.sun.star.lang.XComponent}; import {%see com.sun.star.uno.UnoRuntime}; /** * A specified document is loaded. * * @param source_File * @return */ public void openDocument(String source_File) { // Query the XComponentLoader interface from the desktop Object. // See this snippet how to get the desktop Object: {%internal ../Office/Office.BootstrapOpenOffice.snip} XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop); PropertyValue[] myProperties = new PropertyValue[1]; myProperties[0] = new PropertyValue(); myProperties[0].Name = "Hidden"; // for open document and do not show user interface use "true" myProperties[0].Value = new Boolean(false); // Load a given document try { XComponent xComponent = xComponentLoader.loadComponentFromURL( createUNOFileURL(source_File), // For createUNOFileURL see: {%internal ../Office/Office.CreateUNOCompatibleURL.snip} "_blank", // New windos 0, // Is ignored myProperties); // Special properties } catch(Exception e) { } } Added Snippet linking features Initial version