We are using Aspose.cells java version 19.7 to generate .xlsx files. One of the use case is that our product users can provide the font type/name value to be applied on the cells. We see that in cases where the provided value exceeds the length of 31, the generated excel document upon opening gives an error about style.xml. I found about this limitation on length by setting the same value using Ms. Excel 365, here the value is automatically truncated every time it exceeds length of 31. The following code can be used to reproduce the issue.
public static void main(String args) throws Exception
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.getWorksheets().get(0);
Cell a = worksheet.getCells().get(CellsHelper.cellIndexToName(0, 0));
Style style = a.getStyle();
style.getFont().setName(“IBM Plex Sans SemiBold, Arial Black”);
In such scenarios, we expect atleast some warning to be logged by the library. I tried using the IWarningCallBack interface to see if there’s any warning reported while saving the workbook but it doesn’t happen.
However, we also use aspose.words java 19.7 version and while saving the document we do get a warning(via IWarningCallBack interface) such as - “Font ‘IBM Plex Sans, Arial’ has not been found. Using ‘Times New Roman’ font instead. Reason: default font substitution.”