У обновления стиля ящика есть некоторые странные проблемы. Возможно, вы должны сначала заполнить эти ячейки некоторым значением.
1) это нормально. d2 имеет левую и верхнюю границу, d3 - левую и верхнюю и d4 - левую и верхнюю
var cell = <get the cell D2>;
cell.CellStyle = <workbook>.CreateCellStyle() as XSSFCellStyle;
cell.CellStyle.BorderTop = BorderStyle.Thin;
cell.CellStyle.BorderLeft = BorderStyle.Thin;
cell = <get the cell D3>;
cell.CellStyle = <workbook>.CreateCellStyle() as XSSFCellStyle;
cell.CellStyle.BorderTop = BorderStyle.Thin;
cell = <get the cell D4>;
cell.CellStyle = <workbook>.CreateCellStyle() as XSSFCellStyle;
cell.CellStyle.BorderTop = BorderStyle.Thin;
2), но здесь d2 имеет левую и верхнюю границу, d3 - верхнюю и d4 верхнюю
var cell = <get the cell D2>;
cell.CellStyle = <workbook>.CreateCellStyle() as XSSFCellStyle;
cell.CellStyle.BorderTop = BorderStyle.Thin;
cell = <get the cell D3>;
cell.CellStyle = <workbook>.CreateCellStyle() as XSSFCellStyle;
cell.CellStyle.BorderTop = BorderStyle.Thin;
cell = <get the cell D4>;
cell.CellStyle = <workbook>.CreateCellStyle() as XSSFCellStyle;
cell.CellStyle.BorderTop = BorderStyle.Thin;
cell = <get the cell D2>;
cell.CellStyle.BorderLeft = BorderStyle.Thin;