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

Free Support Forum - aspose.com

Problems with HtmlString in Aspose.Cells in version 21.9.0

Howdy!
Recently, we moved to .NET Core (version 5.0) and upgraded Aspose from 20.6.0.0 to 21.9.0
This has caused some problems with formatting “Html Cells”. Here is how to duplicate the issue.
Keep in mind that my code is with .NET Core 5 (which may or may not matter).
Also, the code below outlines a fix (I mean a hack which resolves the issue).

        var myDir = @"YourDirectory";
        var htmlString = "<font style=\"font-size:20pt;\">Test</font><br/>";
        var htmlSaveOptions = new HtmlSaveOptions
        {
            CellCssPrefix = "Av",
            ExportActiveWorksheetOnly = true,
            ExportImagesAsBase64 = true,
            PresentationPreference = true,
        };

        Workbook wb = new Workbook();
        Worksheet ws = wb.Worksheets[0];
        var cell = ws.Cells[1, 1];
        cell.HtmlString = htmlString;
        wb.Worksheets.ActiveSheetIndex = 0;
        wb.Save(myDir + "TestAsPoseExcel_NetCore_21_9_0_Bad.html", htmlSaveOptions);
       // Please check that the file above has bad font.
       // Now, before disposing we save the file in Xlsx format , to reopen it and save as Html again.
       // This is to show that after saving and re-opening and then saving as Html everything works 
        wb.Save(myDir + "TestAsPoseExcel_NetCore_21_9_0.xlsx", SaveFormat.Xlsx);
        wb.Dispose();

        wb = new Workbook(myDir + "TestAsPoseExcel_NetCore_21_9_0.xlsx");
        wb.Worksheets.ActiveSheetIndex = 0;
        wb.Save(myDir + "TestAsPoseExcel_NetCore_21_9_0_Good.html", htmlSaveOptions);
        wb.Dispose();

One more observation, if one removes “
” from the end of “htmlString” then things appear to be working as well. But, on the other hand there is nothing wrong with “
” tag …
Thx,
Bogdan

@bogdanw,
We have observed the issue and logged into our database for detailed analysis. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSNETCORE-270 - Problems with HtmlString Font when Excel saved as HTML once

Could you please explain more by providing exact string to be used in testing?

@bogdanw,

This is to inform you that we have fixed your issue now. We will provide you the fixed version within the next few days after performing QA and incorporating other enhancements and fixes.

Hi Amjad,
I have found another issue with 21.9.0, this time it (seems to) remove used styles
when calling “RemoveUnusedStyles”.
I have created a topic for this at (see the link below please)
but it does not allow me to download Excel file.
So, I am attaching the file to this email.
If there is another way to attach a file to the top let me know please.
Thanks for you help,
Bogda
https://forum.aspose.com/t/removeunusedstyles-function-seems-to-remove-used-styles-in-aspose-cells-version-21-9-0/236247

(Attachment TestAsPoseExcel_NetCore_21_9_0.xlsx is missing)

@bogdanw,

Please follow up your other thread here.

@bogdanw
Please try the latest fix 21.9.5.
Aspose.Cells21.9.5 For .NetStandard20.Zip (5.6 MB)

The issues you have found earlier (filed as CELLSNETCORE-270) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao