I tested CSS styling as part of HTML being converted to XLSX by Aspose 16.12.4.0. The following sample renders OK:
<html>But if I change the CSS selector on line 5 (td th) by any of the following, styling is ignored. This is not in line with HTML import logic in Excel.
<head>
<title>Test</title>
<style type=“text/css”>
tr td {
text-align: center;
font-weight: bold;
color: red;
}
</style>
</head>
<body>
<table>
<tr><td>Should be red, centered, bold.</td></tr>
</table>
</body>
</html>
- table td
- table tr td
<tr><td class=“MyCell”>Should be red, centered, bold.</td></tr>The following CSS selector works OK:
- .MyCell
- td
- td.MyCell
- tr td
- tr td.MyCell
- tr .MyCell
- table td
- table td.MyCell
- table .MyCell
- table tr td
- table tr td.MyCell
- table tr .MyCell
There is similar behavior when both the row and the cell have a CSS class. Again, this selector works:
- .MyCell
- tr td
- tr .MyCell
- .MyRow td
- .MyRow .MyCell
- All variations that start with table.
<tr class=“MyRow”><td>Should be red, centered, bold.</td></tr>These selectors work:
- td
- tr td
And these do not work:
- .MyRow td
- All variations that start with table.
Please let me know if you have any questions or need any help reproducing these issues.