com.sun.star.io.XInputStream Java Examples
The following examples show how to use
com.sun.star.io.XInputStream.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DocumentLoader.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Loads document on the basis of the submitted XInputStream implementation. * * @param serviceProvider the service provider to be used * @param xInputStream OpenOffice.org XInputStream inplementation * @param properties properties for OpenOffice.org * * @return loaded Document * * @throws Exception if an OpenOffice.org communication error occurs * @throws IOException if document can not be found */ public static IDocument loadDocument(IServiceProvider serviceProvider, XInputStream xInputStream, PropertyValue[] properties) throws Exception, IOException { if (properties == null) { properties = new PropertyValue[0]; } PropertyValue[] newProperties = new PropertyValue[properties.length + 1]; for (int i = 0; i < properties.length; i++) { newProperties[i] = properties[i]; } newProperties[properties.length] = new PropertyValue(); newProperties[properties.length].Name = "InputStream"; newProperties[properties.length].Value = xInputStream; Object oDesktop = serviceProvider.createServiceWithContext("com.sun.star.frame.Desktop"); XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, oDesktop); return loadDocument(serviceProvider, xComponentLoader, "private:stream", "_blank", 0, newProperties); }
Example #2
Source File: OfficeResourceProvider.java From yarg with Apache License 2.0 | 5 votes |
public XComponent loadXComponent(XInputStream inputStream) throws com.sun.star.lang.IllegalArgumentException, IOException { XComponentLoader xComponentLoader = getXComponentLoader(); PropertyValue[] props = new PropertyValue[2]; props[0] = new PropertyValue(); props[1] = new PropertyValue(); props[0].Name = "InputStream"; props[0].Value = inputStream; props[1].Name = "Hidden"; props[1].Value = true; return xComponentLoader.loadComponentFromURL("private:stream", "_blank", 0, props); }
Example #3
Source File: OfficeResourceProvider.java From yarg with Apache License 2.0 | 5 votes |
public XInputStream getXInputStream(ReportTemplate reportTemplate) { try { return new OfficeInputStream(IOUtils.toByteArray(reportTemplate.getDocumentContent())); } catch (java.io.IOException e) { throw new OpenOfficeException("An error occurred while converting template to XInputStream", e); } }
Example #4
Source File: DocumentLoader.java From noa-libre with GNU Lesser General Public License v2.1 | 2 votes |
/** * Loads document on the basis of the submitted XInputStream implementation. * * @param serviceProvider the service provider to be used * @param xInputStream OpenOffice.org XInputStream inplementation * * @return loaded Document * * @throws Exception if an OpenOffice.org communication error occurs * @throws IOException if document can not be found */ public static IDocument loadDocument(IServiceProvider serviceProvider, XInputStream xInputStream) throws Exception, IOException { return loadDocument(serviceProvider, xInputStream, null); }