是的,使用的是GcExcel4.0版本,边框和背景色等样式是通过设置属性设置的,先设置D列的样式再设置BC列的样式就有这种问题,因为D列是用户提前设置的,BC是计算列,根据单元格内容不同不一样,所以只能后设置。
我这边之前也遇到过这类问题,就是通过属性设置边框样式时相邻单元格的边框会受影响,但是不知道怎么解决目前的这个问题。
后端设置样式代码为:
IWorkbook workBook = _workBook.Init();
workBook.FromJson(ssjson);
var cell3 = workBook.ActiveSheet.Range["D4: D26"]; //:和D之间加了空格,不然会变成表情。
cell3.Interior.Color = Color.FromArgb(240, 241, 244);
cell3.Locked = true;
cell3.Font.Size = 10.5;
cell3.IndentLevel = 0;
cell3.Borders.Color = Color.FromArgb(225, 227, 230);
cell3.HorizontalAlignment = HorizontalAlignment.Right;
cell3.Borders.LineStyle = BorderLineStyle.Thin;
var cell1 = workBook.ActiveSheet.Range["B4:B26"];
cell1.Interior.Color = Color.FromArgb(240, 241, 244);
cell1.Locked = true;
cell1.Font.Size = 10.5;
cell1.IndentLevel = 0;
cell1.Borders.Color = Color.FromArgb(225, 227, 230);
cell1.HorizontalAlignment = HorizontalAlignment.Right;
cell1.Borders.LineStyle = BorderLineStyle.Thin;
var cell2 = workBook.ActiveSheet.Range["C4:C26"];
cell2.Interior.Color = Color.FromArgb(240, 241, 244);
cell2.Locked = true;
cell2.Font.Size = 10.5;
cell2.IndentLevel = 0;
cell2.Borders.Color = Color.FromArgb(225, 227, 230);
cell2.HorizontalAlignment = HorizontalAlignment.Right;
cell2.Borders.LineStyle = BorderLineStyle.Thin; |