/// <summary> /// /// </summary> /// <typeparam name="TItem"></typeparam> /// <typeparam name="TExporter"></typeparam> /// <param name="enumerable"></param> /// <param name="target"></param> /// <param name="configuration"></param> private static void Export <TItem, TExporter>(IEnumerable <TItem> enumerable, string target, ExportConfiguration configuration) where TExporter : IExporter, new() { // get metadata var metadata = MetadataReader.ReadMetadata(typeof(TItem)); // write to intermediate var valuesReader = new ValuesReader <TItem>(metadata, configuration); var values = valuesReader.ReadValues(enumerable); // export intermediate to target var exporter = new TExporter() { TargetPath = target, Rows = values }; exporter.Export(); }
public ValuesReader(List <ExportProperty> properties, ExportConfiguration configuration) { _properties = properties; _configuration = configuration; }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="enumerable"></param> /// <param name="target"></param> /// <param name="configuration"></param> public static void ExportToExcel <T>(this IEnumerable <T> enumerable, string target, ExportConfiguration configuration) => Export <T, ExcelExporter>(enumerable, target, configuration);