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