Icon Sets Become Misaligned on Conversion to HTML

Hello,

The attached workbook IconSets.xlsx, contains a simple table with conditional formats that use Icon Sets.

Under the latest version of Aspose Cells for Java version 18.10 - when the workbook is saved as HTML, the resulting HTML shows the icons at an unexpected locations.

This can be reproduced with the following code:

  final String xlFile = [PATH] + "IconSets.xlsx";
  final String sheetName = "Sheet1";
  
  Workbook wb = new Workbook(xlFile);
  Worksheet sheet = wb.getWorksheets().get(sheetName);
  wb.getWorksheets().setActiveSheetIndex(sheet.getIndex());

  String htmlFile = xlFile.replace(".xlsx", "-" + sheetName + ".html");
  wb.save(htmlFile);
  System.out.println("Successfully created HTML file:\n  " + htmlFile);

When you view the produced HTML file in any browser, you should see the misaligned icons (as compared to the worksheet as rendered in Excel).

Thanks

@oraspose,

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-42744 - Icon Sets become misaligned when XLSX is converted to HTML

Thank you Ahsan!

Upon further examination, it seems that not only Icon Sets become misaligned - this issue also affects conditional formatting with Data Bars.

Attached please find MisalignedConditionalFormats.xlsx (8.0 KB) which contains several Conditional Formats. Each of the ranges where conditional formats are applied have conversion issues - which you can see by comparing the resulting HTML versus the way the sheet is rendered in Excel.

The commonality between the conditional formats (in the attachment) is that the underlying cell values are hidden and the cells (with the conditional formats) have different alignments. This seems to affect the alignment of the images that are used in the generated HTML.

Thanks again.

@oraspose,

Thank you for providing more information. We have recorded this information with the logged ticket for our reference. We will consider it while working on this issue.

@oraspose,

This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@oraspose,

Please try our latest version/fix: Aspose.Cells for Java v18.11.1 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells for Java_v18.11.1.zip (6.3 MB)

The issues you have found earlier (filed as CELLSJAVA-42744) have been fixed in Aspose.Cells for Java 18.12. You can also get the latest Aspose.Cells for Java version from Maven repos. with simple configurations. Please see the document for your reference: Installation|Documentation

This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi

Amjad,

Thank you for providing the fix to the secondary “misalignment issue” we raised above. We have tested the fix under the latest Cells version 19.1 and it looks good. However, this fix may have caused regression on other types of conditional formats that do not use icon sets.

Please try the code described at the top of this thread but using the attached MissingDataWithCondFmts.xlsx workbook. If you compare the HTML output to the XLSX file, you can see that the data in columns D and F - which have conditional formatting - is omitted when viewed in a browser.

Specifically, if you examine the generated HTML, you can see the following pattern:

<td height='19' class='x24' width='86' style='text-align:right;mso-ignore:style;font-size:11pt;color:#000000;
    font-weight:400;text-decoration:none;text-line-through:none;font-family:"Calibri";background:#FEEA83;
    mso-pattern:auto none;' align='left' valign='top'>
  <div  style='mso-ignore:vglayout2;margin-left:0px;'>
   <table cellpadding='0' cellspacing='0'>
    <tr>
      <td height='19' class='x24' width='86' align='right' x:num="1.415718438682356" x:fmla="=B3/C3"
          style='visibility:hidden'>142%</td>
    </tr>
   </table>
  </div>
</td>

Note that the 'visibility:hidden' style used in the <td> of the inner <table> node is causing the cell values to be hidden.

If there is a way to workaround this by specifying specific HtmlSaveOptions or something else please let us know. Otherwise, we may not be able to use Cells 19.1 because of the regression.

Thanks again.

@oraspose,

We are afraid to share that no workaround is available for this issue. We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-42826 - Data with conditional formatting ommitted while XLSX to HTML conversion

@oraspose,

This is to inform you that we have fixed your issue “CELLSJAVA-42826” now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@oraspose,

@softwarelicense_aixgroup_com,

Please try our latest version/fix: Aspose.Cells for Java v19.1.8 (attached):

Your issue “CELLSJAVA-42826” should be fixed in it.

Let us know your feedback.
Aspose.Cells for Java_v19.1.8.zip (6.4 MB)

Thank you Amjad! The patch works well. :smiley:

@oraspose,

Good to know that your issue is sorted out by the hotfix. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSJAVA-42826) have been fixed in Aspose.Cells for Java 19.2. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi

We are looking into upgrade of Aspose.Cells to version 23.11 and noticed possible regression in the way HTML is created for this use case.
The most significant difference is around changing all <div elements within table cells into <span , although it might not be the root cause of this issue.
Please take a look at the attached zip file , containing:

  • Small sample program illustrating the issue
  • ConditionalFormatsIcons.xlsx - input template (similar to the one reported in the original issue)
  • ConditionalFormatsIconsOutputCells_v21.3.0.docx
    and
  • ConditionalFormatsIconsOutputCells_v23.11.0.docx - output word documents after inserting the HTML generated from the excel template.
    Looks like icons that were previously center-aligned , now are pushed to the left. Same with the right-aligned icons.

Environment details:

OS Name: Microsoft Windows 11 Pro; also reproducible on Linux 7
MS Office: Version 2208 Build 16.0.15601.20698 32-bit

Please let us know if you need anything else.
Thank you.
ConditionalFormatsIconsMisalignedIssue.zip (46.6 KB)

@oraspose
Please check the generated html
23.11.zip (5.0 KB)

It can display fine in brower. So maybe we should check this issue with Aspose.Words.
If you think so too, I will move this issue to Words formun.
Sorry for inconvenience caused by our change.

We agree that a browser will render the HTML properly, but ultimately we are concerned about how it renders in Word. While we could ask the Aspose Word team to look into this issue - it’s quite possible that they will suggest that we ask the Cells team to fix the HTML. We’d like to avoid a catch-22 situation.
Because the output from Cells version 21.3 produces the appropriate output (in Word) - this issue may prevent us from upgrading to version 23.11. Is there any way we can revert to the same HTML output that we currently get under Cells verison 21.3?

@oraspose,

We apologize for the inconvenience. We will look into it and get back to you soon.

@oraspose,

Sorry for any inconvenience caused. In early versions, we adopted left alignment and then increased offset to adjust the position.
For example:

text-align:left, margin-left:30px

In the latest version, we have adopted alignment consistent with Excel, with a small amount of relative positional offset.
For example:

text-align:center, margin-left:-7.5px

In the browser, the display effect remains the same as before and can be perfectly presented. The deviation between the old and new versions after importing into Word is mainly due to Word’s inability to parse correctly. Therefore, to solve the issue of positional errors after importing into Word, you need to create relative issue on the Word forum.