Abnormal height of column header after freezing Excel cells

Normal Excel display effect:
Normal row height.jpg (118.2 KB)
Abnormal display after saving as HTML file:
Abnormal row height.png (33.0 KB)

Here is the converted code and attachments:

Workbook workbook = new Workbook(“D:/test/spreadsheet/personnel_positions.xlsx”);
workbook.save(“D:/test/spreadsheet/personnel_positions.html”);

personnel_positions.zip (77.9 KB)

@xhaixia
By using sample files and code for testing, we are able to reproduce the issue. Discovered that row height error when converting file to HTML.

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-45874

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.

@xhaixia ,

The row height of Excel is fixed, however in html when the cell is set to WrapText and the text exceeds the cell, it will automatically wrap and the row height will increase. Therefore, if you want to keep the row height the same as in excel, it need to unwrap text and hide the characters beyond the cell. If this solution is acceptable to you, please try the following code for your reference:

Workbook wb = new Workbook(file);
        Cells cells = wb.getWorksheets().get(0).getCells();
        for (int i = 0; i <= cells.getMaxRow(); i++)
        {
            for (int j = 0; j <= cells.getMaxColumn(); j++)
            {
                Cell cell = cells.get(i, j);
                Style style = cell.getStyle();
                style.setTextWrapped (false);
                style.setHorizontalAlignment(TextAlignmentType.LEFT);
                cell.setStyle(style);
            }
        }
        HtmlSaveOptions saveOptions = new HtmlSaveOptions();
        saveOptions.setHtmlCrossStringType (HtmlCrossType.FIT_TO_CELL);
        wb.save(destFile, saveOptions);

If you have any comments or suggestions pelease feel free to contact us, we will be happy to help you as soon as possible.

@xhaixia ,

We have added HtmlSaveOptions.HideOverflowWrappedText to hide some text if the cell is wrapped, then row won’t automatically increase in size in browser. But you only can see a part of cell’s value, it will be displayed just like in Excel.
Attached is the result after fix for your reference:
CELLSJAVA-45874.zip (38.6 KB)

Please call HtmlSaveOptions.setHideOverflowWrappedText() as following code when the next version is released:

saveOptions.setHideOverflowWrappedText(true);
wb.save(destFile, saveOptions);

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