Password not working for LibreOffice calc file

Hi, I’m using Aspose.Cells for Java for removing passwords from Office documents. This works fine for a password protected OpenOffice Calc file.
If I create the file the same way with LibreOffice Calc, creating the Workbook fails with InvalidPasswordException. Although I can open the ods file with the same password in LibreOffice (and OpenOffice).
The Aspose.Cells page says that OpenOffice ods is supported. So, LibreOffice isn’t explicitly mentioned.

Are there known limitations around password protected LibreOffice Calc documents?

@spfaff,

Could you please zip and attach your sample file (password protected created in LibreOffice) here. Also, paste your sample code that you are using to load the file into Aspose.Cells object model. We will check your issue soon.

LibreOffice Version:

Version: 7.3.7.2 (x64) / LibreOffice Community
Build ID: e114eadc50a9ff8d8c8a0567d6da8f454beeb84f
CPU threads: 12; OS: Windows 10.0 Build 18363; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL

OpenOffice and LibreOffice Sample file, password is “password”

samples.zip (16.0 KB)

Sample code:

import com.aspose.cells.LoadOptions;
import com.aspose.cells.Workbook;

import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;

public class LibreCalcSample {
    /**
     * Usage LibreCalcSample [path] [password]
     */
    public static void main(String[] args) throws Exception {
        LoadOptions loadOptions = new LoadOptions();
        loadOptions.setPassword(args[1]);

        System.out.println("Opening " + args[0]);
        try(InputStream fis = Files.newInputStream(Paths.get(args[0]))) {
            Workbook workbook = new Workbook(fis, loadOptions);
            System.out.println("Successfully opened " + args[0]);
        }
    }
}

@spfaff,

Thanks for the sample files and details.

Please notice, I am able to reproduce the issue as you mentioned by loading your sample ODS file (created in LibreOffice). I found the password is not working when opening LibreOffice Calc file (ODS), I got the exception as you pointed out. It works fine though with other similar ODS file which is created in OpenOffice. I have logged a ticket with an id “CELLSJAVA-45051” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@spfaff,

This is to inform you that your issue has been resolved. The fix will be included in our next upcoming release, Aspose.Cells for Java v23.3, scheduled for the first half of March 2023. You will be notified when a new version is released.

The issues you have found earlier (filed as CELLSJAVA-45051) have been fixed in Aspose.Cells for Java 23.3.