public DataTableExportAutoConfig AddColumn(IColumnExportConfig columnConfig) { Check.DoRequireArgumentNotNull(columnConfig, "columnConfig"); Check.DoCheckArgument(GetColumnBySheetIndex(columnConfig.Index) == null, "The sheet column population is already configured"); _columns.Add(columnConfig); return(this); }
/// <summary> /// Get 1-based column index of the column in the sheet. /// </summary> private int GetSheetColumnIndex(IColumnExportConfig columnConfig) { return(GetSheetColumnIndex(columnConfig.Index)); }
private void FormatCell(ExcelStyle excelStyle, Color?backgroundColor, Color?fontColor, IColumnExportConfig columnConfig) { if (excelStyle == null) { return; } if (backgroundColor.HasValue) { excelStyle.Fill.PatternType = ExcelFillStyle.Solid; excelStyle.Fill.BackgroundColor.SetColor(backgroundColor.Value); } if (fontColor.HasValue) { excelStyle.Font.Color.SetColor(fontColor.Value); } SetUpBorder(excelStyle, columnConfig.CellBorderColor, columnConfig.CellBorderStyle); }