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

Free Support Forum - aspose.com

Superscripts and subscripts not formatted correctly when converting an HTML document to a Workbook

Hi Support Team,

Aspose Cells for Java version: 21.5.5

When creating a workbook by passing an HTML document to the constructor, any text within <sup> or <sub> tags within a table does not appear as a superscript or subscript.

Additionally, the text size for the complete string appears to be smaller, rather than just for the superscript or subscript text.

Workbook workbook = new Workbook("test.html");
workbook.save("test.xlsx");

test.html:

<html>
<head></head>
<body>
	<table border="1">
		<thead>
			<tr>
				<th>Volume (m<sup>3</sup>)</th>
				<th>Area (m<sup>2</sup>)</th>
				<th>CO<sub>2</sub></th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>Volume (m<sup>3</sup>)</td>
				<td>Area (m<sup>2</sup>)</td>
				<td>CO<sub>2</sub></td>
			</tr>
			<tr>
				<td>Volume (m3)</td>
				<td>Area (m2)</td>
				<td>CO2</td>
			</tr>
		</tbody>
	</table>
</body>
</html>

Attached are two images:

  1. test.html rendered in a browser
  2. The contents of text.xlsx

html_output_in_browser.jpg (10.0 KB)
generated_xlsx_content.jpg (25.8 KB)

Any advice would be appreciated!

1 Like

@mclark,
We have observed this issue and logged it into our database for further investigation. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSJAVA-43482 - Superscripts and subscripts not formatted correctly when converting an HTML document to a Workbook

@mclark,
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.

@mclark,
Please try our latest version/fix: Aspose.Cells for Java v21.6.6 (attached)
aspose-cells-21.6.6-java.zip (7.3 MB)

Your issue should be fixed now.
Let us know your feedback.

Perfect! Many thanks for this fix! :slight_smile:

@mclark,

You are welcome.

The issues you have found earlier (filed as CELLSJAVA-43482) have been fixed in this update.