We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML format issue with background-color

Thanks for the update . My manager is agreed to renew the subscription .

Please let me know the exact date when will this fix be available ? so that we can plan accordingly


We cannot share exact date as releases are published once ready. However, you may expect the fix around August 10, 2022.

we have been in process to renew the support . Meanwhile I found some more issue with aspose-cells-21.7.jar . Could you please check the same with latest jar if those are not address in the latest jar then you can include those fixes in the upcoming release .

I am attaching my UI screen and report output .
I see that there are a lot of things which are not matching as UI screen when it is writing into the excel sheet .

For ex - Heading 1 , Heading 2 , red color missing etc .

I have also attached the HTML content to that you can check with the latest API UI_Screen.docx (59.6 KB)
HTMLContent.docx (13.1 KB)
Report Output.docx (49.6 KB)

Please check dest.zip (6.5 KB)
with the latst inner hot fix.
We found two issues :
1,Some spaces are lost before “I am using quotes icon”
2, H1,H2 tags should new line
We have logged a ticket with the ID “CELLSJAVA-44791” for your issues.
If you find other issues, please share us, we will check them soon, Thanks !

Please check22.7.3.zip (6.5 KB)
generated with hot fix 22.7.3

Thanks Simon . There are some CSS classes in the HTML content which I shared you earlier .
Can we store CSS file and applied those CSS during HTML formatting ?

the UI screen which I shared , you can see there are some text “center and right aligned” . The ask from business to match excel report same as UI screen .

I shared the output file provided by you with business they have below concerns and said that the output file not exactly matching with Screen UI .

Not working : Quotes, </>, Indentation, Paragraph icon, alignment, font type, Text size- like huge.

Working : Bold, Italics, Underline, Strikethrough, Heading 1-6, bullets, numbered bullets, font colour

Please explain more about tags which do not work.
3.png (26.5 KB)
The result of 22.7.3 is similar to display in the Chrome.

Hi Simon,

The following are not working

  1. Font type ( I am serif font- different font type )
  2. Font Size ( I am Huge text)
  3. Alignment ( For ex . I am center aligned , I am right aligned )
  4. Indentation ( I am an intended bullet )

Above all are not matching with Screen UI


We will look into it and get back to you soon۔

Cell.HtmlString does not support CSS.And we have no plan to support CSS in setting Cell.HtmlString now.
The 4 mentioned issues are about CSS.
BTW Alignment and Indentation only work for whole cell value in MS Excel, we can not format them to the part value of the cell.

Thank , Simon.

You mean that the Framework does not support CSS using Classes ?

Because I see that Framework supports inline CSS .

Please provide more clarity in details .


Aspose.Cells does not support CSS for HtmlString attribute. Anyways, we will get back to you to clarify you more on it.

We only support " Inline CSS" on https://www.w3schools.com/css/css_howto.asp.
And MS Excel only can change font of part content of a cell, not support applying number format, aligment ,borders and background to part content of a cell, so some style settings will be ignored when setting Cells.HtmlString for the limitation of MS Excel.

The issues you have found earlier (filed as CELLSJAVA-44791,CELLSJAVA-44741) have been fixed in this update. This message was posted using Bugs notification tool by Peyton.Xu

Thanks, Simon for your response .

Will “Aspose.Cells for Java 22.8” have all my fixes ?

Hi Simon,

Will Font Type, Font size and indentation work in the case of inline CSS ?


The following issues were resolved in the Aspose.Cells for Java 22.8:

  • CELLSJAVA-44741 - Line break is not right in the output xlsx after set html string into cell
  • CELLSJAVA-44791 - Enhance parsing html string to cell (some spaces were lost and H1, H2 tags should render new line)

As we told you earlier, MS Excel can only change font of part of contents in a cell, MS Excel does not support to apply number format, alignment, borders and background for a part of content of a cell. Same is the case with Aspose.Cells, so some style settings will be ignored when setting Cells.HtmlString due to the limitation of MS Excel.

Thanks, Amjad.

I have got one more issue related to text color . I am attaching HTML content, Report output and UI screen . If you see that the report text color is not matching with UI text color ,
The issue exist in the second row . First row is exactly matching with UI screen

Please help to look into this . HTMLContent_ColorIssue.docx (14.7 KB)
ReportOutput Color issue.docx (51.3 KB)
UI_Screen Color issue.docx (59.2 KB)


Thanks for the sample documents.

Please notice, I am able to reproduce the issue as you mentioned. I used the following sample code to apply an HTML string to the cell. It works ok for first line but not for the second list.
Sample code:

Workbook workbook =  new Workbook();
Worksheet worksheet = workbook.getWorksheets().get(0);
Cell cell = worksheet.getCells().get("A1");
cell.setHtmlString("<html><ol><li><span style=\"color: rgb(136, 136, 136);\">Ability </span><span style=\"color: rgb(230, 0, 0);\">to </span><span style=\"color: rgb(255, 153, 0);\">apply </span><span style=\"color: rgb(178, 178, 0);\">different </span><span style=\"color: rgb(0, 138, 0);\">colors </span><span style=\"color: rgb(0, 102, 204);\">to </span><span style=\"color: rgb(153, 51, 255);\">text.</span></li><li><strong style=\"color: rgb(136, 136, 136);\"><em><s><u>Ability </u></s></em></strong><strong style=\"color: rgb(230, 0, 0);\"><em><s><u>to </u></s></em></strong><strong style=\"color: rgb(255, 153, 0);\"><em><s><u>apply </u></s></em></strong><strong style=\"color: rgb(178, 178, 0);\"><em><s><u>different </u></s></em></strong><strong style=\"color: rgb(0, 138, 0);\"><em><s><u>colors </u></s></em></strong><strong style=\"color: rgb(0, 102, 204);\"><em><s><u>to </u></s></em></strong><strong style=\"color: rgb(153, 51, 255);\"><em><s><u>text</u></s></em></strong><strong><em><s><u> including bold, italics, underline and strike.</u></s></em></strong></li></ol><p><br></p><p><br></p></html>");

I have logged a ticket with an id “CELLSJAVA-44833” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.