使用NPOI设置表格边框的问题
rglhb 2016-07-02 01:35:46 使用NPOI设置表格的第一行和最后一行的上下边框分别为加粗状态,结果,最后一行下边框显示正常,而第一行上边框显示无变化,下边框倒是加粗了。即使把后3行代码删除了,仍然还是同样结果
for (int i = 0; i < 57; i++) //设置表格外围上下边框加粗
{
ICellStyle newCellStyle = myWorkBook.CreateCellStyle();
newCellStyle.CloneStyleFrom(mySheet.GetRow(0).GetCell(i).CellStyle);
newCellStyle.BorderTop = BorderStyle.Medium;
mySheet.GetRow(0).GetCell(i).CellStyle = newCellStyle;
newCellStyle.CloneStyleFrom(mySheet.GetRow(rowIndex - 1).GetCell(i).CellStyle);
newCellStyle.BorderBottom = BorderStyle.Medium;
mySheet.GetRow(rowIndex - 1).GetCell(i).CellStyle = newCellStyle;
}