gpt4 book ai didi

com.sun.star.frame.XStorable类的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 17:39:05 25 4
gpt4 key购买 nike

本文整理了Java中com.sun.star.frame.XStorable类的一些代码示例,展示了XStorable类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XStorable类的具体详情如下:
包路径:com.sun.star.frame.XStorable
类名称:XStorable

XStorable介绍

暂无

代码示例

代码示例来源:origin: org.libreoffice/officebean

public void storeToURL( /*IN*/ String aURL, /*IN*/ com.sun.star.beans.PropertyValue[] aArguments )
  throws com.sun.star.io.IOException
{
  xStorable.storeToURL( aURL, aArguments );
}

代码示例来源:origin: org.libreoffice/officebean

public String getLocation(  )
{
  return xStorable.getLocation();
}

代码示例来源:origin: org.libreoffice/officebean

public boolean hasLocation(  )
{
  return xStorable.hasLocation();
}

代码示例来源:origin: org.libreoffice/officebean

public void store(  )
  throws com.sun.star.io.IOException
{
  xStorable.store();
}

代码示例来源:origin: org.libreoffice/officebean

public boolean isReadonly(  )
{
  return xStorable.isReadonly();
}

代码示例来源:origin: stackoverflow.com

String storeUrl = "file:///C:/Users/JimStandard/Desktop/Test.odt";
XStorable xStorable = (XStorable) UnoRuntime.queryInterface(
  XStorable.class, xTextDocument);
PropertyValue[] storeProps = new PropertyValue[1];
storeProps[0] = new PropertyValue();
storeProps[0].Name = "Overwrite";
storeProps[0].Value = new Boolean(true);
try {
  xStorable.storeToURL(storeUrl, storeProps);
} catch (com.sun.star.io.IOException ex) {
  ex.printStackTrace(System.err);
  System.exit(1);
}  
try {
  URL url = new URL(storeUrl);  // this is 
  Path testPath = Paths.get(url.toURI());
  byte[] data = Files.readAllBytes(testPath);
  System.out.println("Length = " + data.length);
} catch (java.io.IOException ex) {
  ex.printStackTrace(System.err);
  System.exit(1);
} catch (URISyntaxException ex) {
  ex.printStackTrace(System.err);
  System.exit(1);
}

代码示例来源:origin: cuba-platform/yarg

public void saveXComponent(XComponent xComponent, XOutputStream xOutputStream, String filterName) throws IOException {
  PropertyValue[] props = new PropertyValue[2];
  props[0] = new PropertyValue();
  props[1] = new PropertyValue();
  props[0].Name = "OutputStream";
  props[0].Value = xOutputStream;
  props[1].Name = "FilterName";
  props[1].Value = filterName;
  XStorable xStorable = as(XStorable.class, xComponent);
  xStorable.storeToURL("private:stream", props);
}

代码示例来源:origin: com.haulmont.yarg/yarg

public void saveXComponent(XComponent xComponent, XOutputStream xOutputStream, String filterName) throws IOException {
  PropertyValue[] props = new PropertyValue[2];
  props[0] = new PropertyValue();
  props[1] = new PropertyValue();
  props[0].Name = "OutputStream";
  props[0].Value = xOutputStream;
  props[1].Name = "FilterName";
  props[1].Value = filterName;
  XStorable xStorable = as(XStorable.class, xComponent);
  xStorable.storeToURL("private:stream", props);
}

代码示例来源:origin: com.github.livesense/jodconverter-core

private void storeDocument(XComponent document, File outputFile) throws OfficeException {
  Map<String,?> storeProperties = getStoreProperties(outputFile, document);
  if (storeProperties == null) {
    throw new OfficeException("unsupported conversion");
  }
  try {
    cast(XStorable.class, document).storeToURL(toUrl(outputFile), toUnoProperties(storeProperties));
  } catch (ErrorCodeIOException errorCodeIOException) {
    throw new OfficeException("could not store document: " + outputFile.getName() + "; errorCode: " + errorCodeIOException.ErrCode, errorCodeIOException);
  } catch (IOException ioException) {
    throw new OfficeException("could not store document: " + outputFile.getName(), ioException);
  }
}

代码示例来源:origin: mirkonasato/jodconverter

private void storeDocument(XComponent document, File outputFile) throws OfficeException {
  Map<String,?> storeProperties = getStoreProperties(outputFile, document);
  if (storeProperties == null) {
    throw new OfficeException("unsupported conversion");
  }
  try {
    cast(XStorable.class, document).storeToURL(toUrl(outputFile), toUnoProperties(storeProperties));
  } catch (ErrorCodeIOException errorCodeIOException) {
    throw new OfficeException("could not store document: " + outputFile.getName() + "; errorCode: " + errorCodeIOException.ErrCode, errorCodeIOException);
  } catch (IOException ioException) {
    throw new OfficeException("could not store document: " + outputFile.getName(), ioException);
  }
}

代码示例来源:origin: com.bbossgroups.plugins/bboss-jodconverter-core

private void storeDocument(XComponent document, File outputFile) throws OfficeException {
  Map<String,?> storeProperties = getStoreProperties(outputFile, document);
  if (storeProperties == null) {
    throw new OfficeException("unsupported conversion");
  }
  try {
    cast(XStorable.class, document).storeToURL(toUrl(outputFile), toUnoProperties(storeProperties));
  } catch (ErrorCodeIOException errorCodeIOException) {
    throw new OfficeException("could not store document: " + outputFile.getName() + "; errorCode: " + errorCodeIOException.ErrCode, errorCodeIOException);
  } catch (IOException ioException) {
    throw new OfficeException("could not store document: " + outputFile.getName(), ioException);
  }
}

代码示例来源:origin: com.artofsolving/jodconverter

private void loadAndExport(InputStream inputStream, Map/*<String,Object>*/ importOptions, OutputStream outputStream, Map/*<String,Object>*/ exportOptions) throws Exception {
    XComponentLoader desktop = openOfficeConnection.getDesktop();
    
    Map/*<String,Object>*/ loadProperties = new HashMap();
    loadProperties.putAll(getDefaultLoadProperties());
    loadProperties.putAll(importOptions);
    // doesn't work using InputStreamToXInputStreamAdapter; probably because it's not XSeekable 
    //property("InputStream", new InputStreamToXInputStreamAdapter(inputStream))
    loadProperties.put("InputStream", new ByteArrayToXInputStreamAdapter(IOUtils.toByteArray(inputStream)));
    
    XComponent document = desktop.loadComponentFromURL("private:stream", "_blank", 0, toPropertyValues(loadProperties));
    if (document == null) {
      throw new OpenOfficeException("conversion failed: input document is null after loading");
    }

    refreshDocument(document);
    
    Map/*<String,Object>*/ storeProperties = new HashMap();
    storeProperties.putAll(exportOptions);
    storeProperties.put("OutputStream", new OutputStreamToXOutputStreamAdapter(outputStream));
    
    try {
      XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, document);
      storable.storeToURL("private:stream", toPropertyValues(storeProperties));
    } finally {
      document.dispose();
    }
  }
}

代码示例来源:origin: stackoverflow.com

System.out.println("starting...");
       String oooExeFolder = "/usr/lib/openoffice/program";
       XComponentContext xContext = BootstrapSocketConnector.bootstrap(oooExeFolder);
       XMultiComponentFactory xMCF = xContext.getServiceManager();
       Object oDesktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
       XComponentLoader xCLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, oDesktop);
       System.out.println("loading ");
       PropertyValue[] printerDesc = new PropertyValue[1];
       printerDesc[0] = new PropertyValue();
       printerDesc[0].Name = "PaperOrientation";
       printerDesc[0].Value = PaperOrientation.LANDSCAPE;
       // Create a document
       XComponent document = xCLoader.loadComponentFromURL(loadUrl, "_blank", 0, printerDesc);
       // Following property will convert doc into requested orientation.
       XPrintable xPrintable = (XPrintable) UnoRuntime.queryInterface(XPrintable.class, document);
       xPrintable.setPrinter(printerDesc);
       PropertyValue[] conversionProperties = new PropertyValue[3];
       conversionProperties[1] = new PropertyValue();
       conversionProperties[1].Name = "FilterName";
       conversionProperties[1].Value = "writer_pdf_Export";// 
       conversionProperties[0] = new PropertyValue();
       conversionProperties[0].Name = "Overwrite ";
       conversionProperties[0].Value = new Boolean(true);
       System.out.println("closing");
       XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, document);
       xstorable.storeToURL(storeUrl, conversionProperties);
       System.out.println("closing");
       XCloseable xcloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, document);
       xcloseable.close(false);

代码示例来源:origin: com.artofsolving/jodconverter

private void storeDocument(XComponent document, String outputUrl, Map storeProperties) throws com.sun.star.io.IOException {
  try {
    XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, document);
    storable.storeToURL(outputUrl, toPropertyValues(storeProperties));
  } finally {
    XCloseable closeable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, document);
    if (closeable != null) {
      try {
        closeable.close(true);
      } catch (CloseVetoException closeVetoException) {
        logger.warn("document.close() vetoed");
      }
    } else {
      document.dispose();
    }
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com