Search code examples
c#bordercellopenxmlspreadsheetml

How to apply outline table border to a cell range using OpenXml?


I set border style for each cell. But if you look closely, you'll see the blue lines are not consecutive. There are some white hash marks across the vertical lines. Because inside the table, I set the top and bottom cell border as white. Anyone knows how to avoid this?

Table Cell

WorksheetPart v_worksheetPart = a_workbookPart.AddNewPart<WorksheetPart>();
v_worksheetPart.Worksheet = new Worksheet();
SheetData v_sheetData = new SheetData();
Row v_Row = new Row();
Cell v_Cell = new Cell();
...
v_Row.Append(v_Cell);
v_sheetData.Append(v_Row);
v_worksheetPart.Worksheet.AppendChild(v_sheetData);
...

Solution

  • Taterhead's solution is a nice one. I have another one here. Instead of drawing white borders, just set the background color of the cell range to white.

    Thanks everyone's help!