Below is my code. Please help.
Code: Select all
XMultiComponentFactory xMultiComponentFactory = xComponentContext.getServiceManager();
Object desktopService = xMultiComponentFactory.createInstanceWithContext("com.sun.star.frame.Desktop", xComponentContext);
XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktopService);
PropertyValue[] conversionProperties = new PropertyValue[3];
conversionProperties[0] = new PropertyValue();
conversionProperties[1] = new PropertyValue();
conversionProperties[2] = new PropertyValue();
conversionProperties[0].Name = "InputStream";
conversionProperties[0].Value = input;
conversionProperties[1].Name = "Hidden";
conversionProperties[1].Value = new Boolean(true);
conversionProperties[2].Name = "IsExportContentsPage" ;
conversionProperties[2].Value = false;
XComponent document = xComponentLoader.loadComponentFromURL("private:stream", "_blank", 0, conversionProperties);
conversionProperties[0].Name = "OutputStream";
conversionProperties[0].Value = output;
conversionProperties[1].Name = "FilterName";
conversionProperties[1].Value = filterName;
XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class,document);
xstorable.storeToURL("private:stream", conversionProperties);
XCloseable xclosable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class,document);
xclosable.close(true);