Free Support Forum - aspose.com

Conversion of Html to Xlsx does not respect styling of the html table

When I open the below html snippet in a Workbook and save as Xlxs then I see two issues:

  1. The table does not have any borders.
  2. The filling is set to white and default Excel borders are gone.

When I do the same using Excel or Excel interop then the formatting is kept as is in html.

Html to be opened in workbook.

ID
Value

@lolbro,

I confirmed the issue as you mentioned by using the following sample code.
e.g
Sample code:

string html = @"<table border=""2px"">
                            <tr>
                            <td>ID</td>
                            </tr>
                            <tr>
                            <td>Value</td>
                            </tr>
                            </table>";

            byte[] byteArray = Encoding.ASCII.GetBytes(html);
            MemoryStream stream = new MemoryStream(byteArray);
            Workbook workbook = new Workbook(stream);
            Worksheet sheet = workbook.Worksheets[0];
            sheet.AutoFitColumns();

            workbook.Save("e:\\test2\\out1.xlsx");

I have logged a ticket with an id “CELLSNET-47690” for your issue. We will look into it soon.

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

@lolbro,

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

Your issue should be fixed in it.

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

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