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

Oliver Brinzing Oliver.Brinzing at gmx.de
Wed Feb 3 18:47:26 CET 2016


Hi William,

> 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.

do you want to load the file "hidden"?
something like this should work:

PropertyValue[] mProps = new PropertyValue[1];
mProps[0] = new PropertyValue();

mProps[0].Name = "Hidden";
mProps[0].Value = new Boolean(true);

XComponent component = loader.loadComponentFromURL(url, "_default", 0, mProps);

Regards
Oliver


Am 02.02.2016 um 10:48 schrieb Zhang, William:
> 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
>
>
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>





More information about the LibreOffice mailing list