Free Support Forum - aspose.com

Conversion of Html to Excel (xlsx) headers with a nested tables are not read consistently

Conversion of a html table to xlsx containing a table nested inside a header results with only one header being read.

    static void Main(string[] args)
    {
        string html = @"<table border=""2px"">
                          <tr><td><table><tbody><tr><th>Header 1</th></tr></tbody></table></td><td><table><tbody><tr><th>Header 2</th></tr></tbody></table></td></tr>
                          <tr><td>Value 1</td><td>Value 2</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.xls");

        Console.WriteLine("Html processed to Xlsx.");
    }

image.png (2.6 KB)

@lolbro,
We have observed this issue and logged it in our database for further investigation and a fix. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSNET-47691 - HTML to Xlsx does not convert table headers properly