コード例 #1
0
        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);
        }
コード例 #2
0
 /// <summary>
 ///     Get 1-based column index of the column in the sheet.
 /// </summary>
 private int GetSheetColumnIndex(IColumnExportConfig columnConfig)
 {
     return(GetSheetColumnIndex(columnConfig.Index));
 }
コード例 #3
0
        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);
        }