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?
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);
...
Just call
ws.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin);
Instead of drawing white borders to cover up the default grey grid lines, you should instead just hide the grid lines of your worksheet. To do this via code you would set the ShowGridLines property to False in the SheetView, like the code in this SO answer.
Then remove your code that added white borders to your solution and leave in the code for the blue borders. This will remove the white breaks in your blue border.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With