private void CreateTable() { if (TableStyle == null) { return; } var table = ActiveWorksheet.Range(1, 1, Data.Count + 1, Columns.Count).CreateTable(); table.Theme = TableStyle; }
private void FormatColumn(ColumnInfo <T> column) { var range = ActiveWorksheet.Range(2, column.Index, Data.Count + 1, column.Index); if (!string.IsNullOrEmpty(column.Mask)) { range.Style.NumberFormat.SetFormat(column.Mask); } if (column.Type == TypesEnum.String) { range.DataType = XLDataType.Text; } if (column.Type == TypesEnum.Bool || column.Type == TypesEnum.NullableBool) { range.DataType = XLDataType.Boolean; } if (column.Type == TypesEnum.Int || column.Type == TypesEnum.NullableInt) { range.DataType = XLDataType.Number; } if (column.Type == TypesEnum.Long || column.Type == TypesEnum.NullableLong) { range.DataType = XLDataType.Number; } if (column.Type == TypesEnum.Decimal || column.Type == TypesEnum.NullableDecimal) { range.DataType = XLDataType.Number; } if (column.Type == TypesEnum.DateTime || column.Type == TypesEnum.NullableDateTime) { range.DataType = XLDataType.DateTime; } }