Output Excel File is Corrupt

Full code below.
Please note that I put empty string in the first column.
When you examine the resulting html file cells in the first column do not have white border.
But if you put manually (into Html table cell) " " they get borders.
So, I need to tell the export mechanism somehow that it should treat empty cells as if they had a value. Another way I guess would be to tell the table (i.e. excel list object) that it should create borders in some particular way. Something like “empty-cell:show” css flag.
Thx.

Workbook wb = new Workbook();
        Worksheet ws = wb.Worksheets[0];

        var outerRange = ws.Cells.CreateRange(0, 0, 10, 10);
        outerRange.SetOutlineBorder(Aspose.Cells.BorderType.TopBorder, CellBorderType.Thick, Color.Blue);
        outerRange.SetOutlineBorder(Aspose.Cells.BorderType.BottomBorder, CellBorderType.Thick, Color.Blue);
        outerRange.SetOutlineBorder(Aspose.Cells.BorderType.LeftBorder, CellBorderType.Thick, Color.Blue);
        outerRange.SetOutlineBorder(Aspose.Cells.BorderType.RightBorder, CellBorderType.Thick, Color.Blue);

        var innerRange = ws.ListObjects[ws.ListObjects.Add(3, 3, 6, 6, true)];
        for(int r = 0; r < 3; r ++)
        {
           for( int c = 0; c < 3; c++)
           {
                if (c > 0)
                    ws.Cells[innerRange.StartRow + r, innerRange.StartColumn + c].PutValue(r + c);
                else
                    ws.Cells[innerRange.StartRow + r, innerRange.StartColumn + c].PutValue(string.Empty);
            }
        }
        innerRange.TableStyleType = TableStyleType.TableStyleDark4;

        var myDir = @"MyDirHere";
        wb.Save(myDir + "TestAsPoseExcel.xlsx");
    
        HtmlSaveOptions saveOptions = new HtmlSaveOptions();
        wb.Save(myDir + "TestAsPoseExcel.xlsx", saveOptions);

@bogdanw

Thanks for using Aspose APIs.

We have executed your code at our end using the most recent version and attached the output Excel and HTML files. The Excel file is corrupt and the first column heading in HTML is lost.

Please check both files and let us know your issues with some screenshots. It will help us identify the issues easily and we will be able to fix them quickly. Thanks for your cooperation and have a good day.

Download Link:
Output Excel and HTML Files.zip (8.8 KB)


This issue has been logged as

  • CELLSNET-46128 - Output Excel File is Corrupt after Creating List Object

@bogdanw

Thanks for using Aspose APIs.

This is to inform you that we have fixed your issue CELLSNET-46128 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

@bogdanw,

Please try our latest hotfix/version: Aspose.Cells for .NET v18.5.1, it should fix your issue:

Please call ListObject.UpdateColumnName(); before saving the file.

Let us know your feedback.

The issues you have found earlier (filed as CELLSNET-46128) have been fixed in Aspose.Cells for .NET 18.6. Please also check the document/article for your reference: Install Aspose Cells through NuGet|Documentation