private static void BuildSheetColumns(Worksheet worksheet, SheetConfiguration configuration) { Columns columns = new Columns(); uint i = 1; foreach (var column in configuration.Columns) { var excelColumn = new Column() { Min = i, Max = i, CustomWidth = true }; i++; if (column.Width.HasValue) { var val = column.Width.Value == 0 ? 0 : column.Width.Value / 6.5; excelColumn.Width = new DoubleValue(val); } else { excelColumn.Width = new DoubleValue(10.0); } columns.Append(excelColumn); } worksheet.Append(columns); }
private static Row GetTitleRow(SheetConfiguration configuration, ExcelStyle style) { var row = new Row(); foreach (var column in configuration.Columns) { var cell = new Cell() { DataType = CellValues.InlineString, InlineString = new InlineString() { Text = new Text(column.Header) }, StyleIndex = style.CellFormatTitleRowId }; row.AppendChild(cell); } return(row); }
public static MemoryStream Generate(SheetConfiguration configuration, ExcelStyle style = null) { return(Generate(new[] { configuration }, style)); }