/// <summary> /// Generates Hidden Worksheets that contain Possible Values for each DropDown /// </summary> static string GenerateDropDownSourceSheet(DropDownColumn <T> column) { var rows = column.PossibleValues. Select(v => $@"<Row><Cell><Data ss:Type=""{column.DataType}"">{v}</Data><NamedCell ss:Name=""{column.EnumerationName}""/></Cell></Row>"); return($@"<Worksheet ss:Name=""{column.EnumerationName}""> <Table> {rows.ToLinesString()} </Table> <WorksheetOptions xmlns=""urn:schemas-microsoft-com:office:excel""> <Visible>SheetHidden</Visible> </WorksheetOptions> </Worksheet>"); }
public Column <T> AddDropDownColumn(string headerText, string type, string enumerationName, IEnumerable <object> possibleValues) { if (headerText.IsEmpty()) { throw new ArgumentNullException(nameof(headerText)); } if (type.IsEmpty()) { throw new ArgumentNullException(nameof(type)); } if (possibleValues == null) { throw new ArgumentNullException(nameof(possibleValues)); } var result = new DropDownColumn <T>(headerText, type, enumerationName, possibleValues.ToArray()); Columns.Add(result); return(result); }