Free Support Forum - aspose.com

Font size wrong when set HtmlString

Hi all,
I set Decimal Symbol to “,” and Digit grouping Symbol to “.” (Region setting) and set html have font size for cell.

var _book = new Workbook();
var _sheet = _book.Worksheets[0];
var _cell = _sheet.Cells[0, 0];
_cell.HtmlString = "<font style=\"font-size:11.5pt\">Test string</font>";

_book.Save("d:\\_output.xlsx", SaveFormat.Xlsx);

if font size is a integer number, it work fine, but if is a decimal number, it will rounded (ex: 11.5 to 115, 8.5 to 85)
How to set correct html decimal font size :frowning:

Thank you.

ConsoleApp1.zip (26.5 KB)

@DungLT,

This is expected behavior and nothing to do with Aspose.Cells APIs. Please note, when you specify Decimal Symbol to “ , ” and Digit grouping Symbol to “ . ” ( Region setting ), obviously 11.5 would be 115 (as “.” would not be considered as decimal separator rather a grouping symbol).

You need to specify font-size in accordance with your settings (Decimal Symbol to “ , ” and Digit grouping Symbol to “ . ” ( Region setting )). For example, you may set as: font-size:11,5pt.

Hope, this helps a bit.

@Amjad_Sahi
I tried replace 11.5pt to 11,5pt but font size changed to 11pt

@DungLT,

It looks like MS Excel rounds the size (after comma) value to whole number so you can only specify size from predefined whole number list (combo box) in Excel. We will check it later on if we can evaluate it or figure it out.

1 Like

@DungLT,

We have logged an investigation ticket with an id “CELLSNET-47658” for your issue (“replace 11.5pt to 11,5pt but font size changed to 11pt”) into our database. We will look into it soon.

Once we have an update on it, we will let you know.

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

@DungLT,

Please try our latest version/fix: Aspose.Cells for .NET v20.9.15 (attached)

Your issue (logged earlier as “CELLSNET-47658”) should be fixed in it.

Let us know your feedback.
Aspose.Cells20.9.15 For .Net2_AuthenticodeSigned.Zip (5.4 MB)
Aspose.Cells20.9.15 For .Net4.0.Zip (5.4 MB)

The issues you have found earlier (filed as CELLSNET-47658) have been fixed in Aspose.Cells for .NET v20.10. This message was posted using Bugs notification tool by Amjad_Sahi. You may also get the version @ Nuget repos. (https://www.nuget.org/packages/Aspose.Cells/20.10.0).