public void AddBorder(ExcelBordersIndex index, ExcelBorderWeight weight, ExcelLineStyle lineStyle) { ExcelBorderItem border = new ExcelBorderItem(index, weight, lineStyle); ExcelBorderItem existingBorder = this[border.Index]; if (null == existingBorder) { Add(border); } else { existingBorder.LineStyle = border.LineStyle; existingBorder.Weight = border.Weight; } }
public ExcelBorderItem(ExcelBordersIndex index, ExcelBorderWeight weight, ExcelLineStyle lineStyle) { Index = index; Weight = weight; LineStyle = lineStyle; }
/// <summary> /// Draws the table border. /// </summary> /// <param name="xlsSheet">The XLS sheet.</param> /// <param name="startRow">The start row.</param> /// <param name="startCol">The start col.</param> /// <param name="endRow">The end row.</param> /// <param name="endCol">The end col.</param> /// <param name="lineStyle">The line style.</param> /// <Author>LONG LY</Author> /// <Date>25/07/2011</Date> private void DrawTableBorder(IWorksheet xlsSheet, int startRow, int startCol, int endRow, int endCol, ExcelLineStyle lineStyle) { xlsSheet.IsGridLinesVisible = false; xlsSheet[startRow, startCol, endRow, endCol].CellStyle.Borders.LineStyle = lineStyle; xlsSheet[startRow, startCol, endRow, endCol].CellStyle.Borders[ExcelBordersIndex.DiagonalDown].ShowDiagonalLine = false; xlsSheet[startRow, startCol, endRow, endCol].CellStyle.Borders[ExcelBordersIndex.DiagonalUp].ShowDiagonalLine = false; xlsSheet[startRow, startCol, endRow, endCol].CellStyle.Borders.ColorRGB = Color.Black; xlsSheet.Range[startRow, startCol, endRow, endCol].WrapText = true; }