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);