Avoid opening the Spreadsheet file when use OpenOffice UNO API to load it

Zhang, William william.zhang at ptn.advantest.com
Tue Feb 2 10:48:36 CET 2016


Hi Team members,

Does anyone know how to do it as the subject describes?  Thanks a lot!

LibreOffice version: 4.1.4.2
OS:RedHat7
Java1.7

My code is as follow:
XComponentContext xContext = OOoConnector.bootstrap(ooExeFolder);
XMultiComponentFactory xMCF = xContext.getServiceManager();
Object desktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
XComponentLoader loader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, desktop);
String url = "file://" + targetFile;
// If execute the next line, the related file will be opened automatically, but we do not want to open it. What we want is change value for some cells and work as background.
XComponent component = loader.loadComponentFromURL(url, "_default", 0, new PropertyValue[0]);
    ……

The default options for the ‘soffice’ command is as follow.
ArrayList<String> options = new ArrayList<String>();
options.add("--nologo");
options.add("--nodefault");
options.add("--norestore");
options.add("--nocrashreport");
options.add("--nolockcheck");
…….

Anyone who knows the solution is much appreciated!

Best Regards
William
From: Zhang, William
Sent: 2015年12月25日 13:08
To: 'libreoffice at lists.freedesktop.org'
Subject: How to decrypt ods file

Hi Team members,

Does anyone know how to decrypt an encrypted Libreoffice Calc file with Java or other languages? Or even some workarounds. Thanks a lot!

LibreOffice version: 4.1.4.2

What I’ve tried.

1.       Try some common decrypt API such as javax.crypto.Cipher, failed.

2.       Change the ‘ods’ extension to ‘zip’, unzip it and try to parse file to get the content, failed.

Then try to get xml content with Java IO, failed.
……

Best Regards
William

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20160202/f42f5197/attachment.html>


More information about the LibreOffice mailing list