javaapache-poiapache-poi-4

How to fix "Some formula symbols might not be displayed correctly due to missing fonts Symbol, Windings..." for an XLSX generated with Apache POI


I have the following code:

    XSSFFont font = createFont(workBook);
    font.setColor(IndexedColors.WHITE.getIndex());
    font.setFontName("Arial");
    font.setBold(true);

    XSSFColor BLUE_WAVE = new XSSFColor(new byte[]{ (byte) 60,
                                                    (byte) 120,
                                                    (byte) 216 },
                                        new DefaultIndexedColorMap());
    
    CellStyle style = workBook.createCellStyle();
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setFillForegroundColor(BLUE_WAVE);
    style.setFont(createHeaderFont(workBook));

    XSSFCell cell = row.createCell(cellIndex);
    cell.setCellType(cellType);
    cell.setCellStyle(style);
    
    // ...
    // Popuplation of cells goes here
    // ...

As illustrated above, the cells have a style. I am not using any fancy fonts. My code generates an .xlsx file successfully without any errors. When I try opening it using WPS office (under Ubuntu), it shows the following warning (and then loads the file normally):

enter image description here

There are no formulas in the xlsx file.

I have the following Gradle dependencies:

implementation("org.apache.poi:poi:5.2.3")
implementation("org.apache.poi:poi-ooxml:5.2.3")

I'm not sure how to debug and fix this. I don't want it to be showing any warnings in WPS or any other office application. Any ideas would be highly appreciated!


Solution

  • This warning message is from WPS Office only. Microsoft Excel will not throw that warning.

    The reason is missing fonts which WPS Office needs to show some equations inserted via Equation Editor. See Write an equation or formula or How to insert equations in WPS Spreadsheet.

    Only those equations are meant by the message. It has nothing to do with spreadsheet cell formulas like =SUM(A1:A100) or similar.

    You fix it by clicking [x] Do not report again.

    Or you might install the missed fonts. See https://askubuntu.com/questions/861588/wps-office-equation-editor.