Difference in HTML output

Hi,

Using Aspose Cells for Java, version 25.7.

Sample code:

Workbook workbook = new Workbook("input.xlsx");
HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.HTML);
saveOptions.setParseHtmlTagInCell(false);
saveOptions.setExportActiveWorksheetOnly(true);
saveOptions.setEncoding(Encoding.getUTF8());
saveOptions.setExportImagesAsBase64(true);

WorksheetCollection sheets = workbook.getWorksheets();
sheets.setActiveSheetName("IT Market initial");

workbook.save("output.html", saveOptions);

See the attached PNG file that highlights the difference in rendering between Aspose and Excel.

Kind regards,
Taras

repro.zip (810.8 KB)

@TarasTielkes

Cause

The differences in HTML output when using Aspose.Cells for Java compared to Excel can arise from various factors, including how certain features, formatting, or styles are handled during the conversion process.

Solution

To address the rendering discrepancies, consider the following adjustments to your HtmlSaveOptions:

  1. Check Export Options: Ensure that the export options you are using are aligned with the desired output. For instance, you might want to enable or disable certain features based on your specific needs.

  2. Adjust CSS and Formatting: You can specify additional CSS styles or modify existing ones to better match the Excel output. This can help in achieving a more consistent look.

  3. Use the Latest Version: Make sure you are using the latest version of Aspose.Cells, as updates often include bug fixes and improvements that could resolve rendering issues.

Code Example

Here’s an updated version of your code with some additional options that might help improve the output:

Workbook workbook = new Workbook("input.xlsx");
HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.HTML);
saveOptions.setParseHtmlTagInCell(false);
saveOptions.setExportActiveWorksheetOnly(true);
saveOptions.setEncoding(Encoding.getUTF8());
saveOptions.setExportImagesAsBase64(true);
saveOptions.setExportHeadings(true); // Export row and column headings
saveOptions.setExportGridLines(true); // Export grid lines if needed
saveOptions.setExportWorksheetCSSSeparately(true); // Export CSS separately

WorksheetCollection sheets = workbook.getWorksheets();
sheets.setActiveSheetName("IT Market initial");

workbook.save("output.html", saveOptions);

Next Steps

  1. Test the updated code and review the output.
  2. If discrepancies persist, compare specific formatting in Excel with the generated HTML to identify what might be missing or misrepresented.
  3. Reach out to Aspose support with specific examples if the issue continues, as they can provide more tailored assistance.

I am confident that these adjustments will help you achieve the desired output. Please let me know if you need further assistance!

@TarasTielkes
It’s very strange that the text of the text box is out of the box.

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

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.

@TarasTielkes
Your issue(CELLSJAVA-46429) has been resolved and the fixed functionality will be released with version 25.8.
Here is the resulting file generated using the latest function:
CELLSJAVA-46429_java.zip (18.0 KB)

Thank you, @duojie.yang

@TarasTielkes
Thank you for your feedback. You are welcome. We will notify you promptly once the version v25.8 is released.