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