Long text truncated in cells

MS Excel has the 32,767 character limit, although other Excel readers such as Google Sheets allow going beyond this limit. Is there a way in which I could bypass the limit and produce an XLSX, even if it means having MS Excel reporting the document as corrupted?

Code sample:

public static void main(String[] args) throws Exception {
        Workbook workbook = new Workbook();
        workbook.getSettings().setCheckExcelRestriction(false);

        Worksheet worksheet = workbook.getWorksheets().get(0);
        Cells cells = worksheet.getCells();
        cells.get("A1").setValue("x".repeat(32767) + " Testing if it works or not");
        System.out.println(new StringBuilder((String) cells.get("A1").getValue()).reverse());


        workbook.save("test.xlsx", SaveFormat.XLSX);

        readValue();
    }

    private static void readValue() throws Exception {
        var workbook = new Workbook("test.xlsx");
        Worksheet worksheet = workbook.getWorksheets().get(0);
        Cells cells = worksheet.getCells();
        System.out.println(cells.get("A1").getValue());
    }

Current output: “Testing if it works or not” is not present
Expected output: “Testing if it works or not” is present

@samuelmartinucci
In order to avoid file crashes, we processed the data that did not meet the restrictions when saving the file. As you can accept corrupted files, we will add option that we never check limitation to support your need.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSJAVA-46191

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@samuelmartinucci,

This is to inform you that your issue (Ticket ID: “CELLSJAVA-46191”) has been resolved. The fix/enhancement will be incorporated in the forthcoming release (Aspose.Cells v24.12), scheduled for the next week of December 2024. You will be notified once the new version is published.

1 Like

@samuelmartinucci
We add an option in SaveOptions as the following in the next version:

 OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
 saveOptions.setCheckExcelRestriction(false);
1 Like

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