Exemplo n.º 1
0
        public static XlsxSerializer <IEnumerable <object> > Create(Type elementType, IEnumerable <object> data)
        {
            var properties = elementType.GetProperties();
            var ps         = properties.Select(x => new Hcs.Expressions.PropertyAccessor(elementType, x.Name)).ToArray();
            var header     = new WriteXlsxRow <object>(0, 0, 0, properties.Select(x => new CellWriter <object>((e, cell) => cell.Value = x.Name)).ToArray());
            var body       = new WriteXlsxRow <object>(0, 1, 0, ps.Select(x => new CellWriter <object>((e, c) => c.Value = x.Getter(e))).ToArray());

            return(new XlsxSerializer <IEnumerable <object> >(new XlsxSerializeSettings <IEnumerable <object> >(header, body)));
        }
Exemplo n.º 2
0
 public WriteXlsxRow(int sheetIndex, int startRow, int startCol, Func <T, IEnumerable <TElement> > select, params ICellWriter <TElement>[] cellWriters)
 {
     rowWriter   = new WriteXlsxRow <TElement>(sheetIndex, startRow, startCol, cellWriters);
     this.select = select;
 }