I am using Aspose.Cells 16.11.0 to convert HTML to XLSX. Recently you made it possible to override default styling of TH elements using CSS. There is a quirk in the implementation; it appears that when I override one of the style attributes of TH, this also affects defaulting of another style attribute of the same TH element. Example:
<html>
<head>
<title>Test</title>
<style type=“text/css”>
.leftaligned {
text-align: left;
}<span style="color:maroon;">.notbold</span> { <span style="color:red;">font-weight</span>: <span style="color:blue;">normal</span>; } <span style="color:blue;"></</span><span style="color:maroon;">style</span><span style="color:blue;">></span>
</head>
<body>
<table>
<tr><th class=“leftaligned”>Should be left-aligned and bold.</th></tr>
<tr><th class=“notbold”>Should be centered and not bold.</th></tr>
</table>
</body>
</html>
In the first row, text-align has been overridden (made left-aligned instead of the default centered), but as a side effect, the text is no longer bold. Since there was no explicit font-weight for that cell, it should have been bold (the default for TH).
In the second row, font-weight has been overridden (made normal instead of the default bold), but as a side effect, the text is left-aligned. Since there was no explicit text-align for that cell, it should have been centered (the default for TH).
To see the correct behavior, please import the HTML straight into Excel.
Adding an explicit rule with TH’s default styling (something I had good experience with in version 8.9.0) does not solve the problem:
th {
font-weight: bold;
text-align: center;
}
Adding the tag name TH to the selectors causes Aspose to ignore the rules:
th.leftaligned {
text-align: left;
}th.notbold {
font-weight: normal;
}
I hope I am doing something wrong myself, otherwise something is seriously broken in the CSS implementation.