/// <summary> /// 解決合並后的單元格沒有邊框,設置合並單元格格式,讓合並過的單元格中每一個單元格上都添加上加邊框的樣式 /// </summary> /// <param name="cells">單元格</param> /// <param name="firstRow">起始行</param> /// <param name="firstColumn">起始列</param> /// <param name="rowNumber">行偏移量</param> /// <param name="columnNumber">列偏移量</param> /// <param name="style">樣式</param> private void SetCellStyle(Cells cells, int firstRow, int firstColumn, int rowNumber, int columnNumber, Style style) { int totalRow = firstRow + rowNumber; int totalColumn = firstColumn + columnNumber; for (int i = firstRow; i < totalRow; i++) { for (int j = firstColumn; j < totalColumn; j++) { cells[i, j].Style = style; } } }
