Generate HTML from Excel XLSX File while Copying Styles using Java

We generate HTML from Excel XLSX file while copying styles using Java (Aspose.Cells). It is found that the effect is abnormal when converting to HTML. It is normal to convert to PDF or excel format
image.png (18.0 KB)
image.png (19.9 KB)

this is the code:

    Workbook workbook = new Workbook("D://Aspose//EPPR_48315//EPPR_48315.xlsx");
    Worksheet worksheet = workbook.getWorksheets().get(0);
    Cells cells = worksheet.getCells();
    Cell cell = cells.get("C4");
    Style style = cell.getStyle();
    // Range C4:C10
    Range r = cells.createRange(3,2,7,1);
    r.setStyle(style);
    workbook.save("D://Aspose//EPPR_48315//EPPR_48315/EPPR_48315_201.html", SaveFormat.HTML);
    workbook.save("D://Aspose//EPPR_48315//EPPR_48315/EPPR_48315_201.xlsx", SaveFormat.EXCEL_97_TO_2003);
    workbook.save("D://Aspose//EPPR_48315//EPPR_48315/EPPR_48315_201.pdf", SaveFormat.PDF);

this is the excel file and result:
EPPR_48315.zip (64.7 KB)

@xhaixia,
We have logged the issue as “CELLSJAVA-43920” in our database for investigations. Once we will have some news for you, we will update you in this topic.

@xhaixia,

We evaluated your issue in details.

In HTML file, the background of Cell C6 is auto/none, it cannot override the background set on the Row 6, see attachment: “background_in_html.png”. Please note, when you generate HTML from Excel XLSX file while copying styles using Java API of Aspose.Cells, you may notice certain differences. Similarly, if you open the generated XLSX file into MS Excel and manually save to HTML (Web page), you will get similar results. So, it is not an issue with the APIs. A possible solution is setting a background color for the range.
e.g.
Sample code:

...
Cell cell = cells.get("C4");
Style style = cell.getStyle();
style.setPattern(BackgroundType.SOLID);
style.setForegroundColor(Color.getWhite());
...

background_in_html.png (118.7 KB)