public IExport InitExport <TEntity>(IExportSimplePage <TEntity> userPage, MyFileType fileType) { IExport exporter = this.GetExporter <TEntity>(fileType, userPage); exporter.BgExport += new EventHandler <BeginExportEventArgs>(userPage.BeginExport); this.SetWrite(exporter); return(exporter); }
private IExport GetExporter <TEntity>(MyFileType fileType, IExportSimplePage <TEntity> userPage) { switch (fileType) { case MyFileType.EXCEL: case MyFileType.EXCEL2003: return(new NPOIExport <TEntity>(userPage.GetDataSource(), userPage.GetHead())); case MyFileType.PDF: case MyFileType.CSV: case MyFileType.HTML: case MyFileType.TXT: return(new DoddleReportExport <TEntity>(userPage.GetDataSource(), userPage.GetHead())); } return(new NPOIExport <TEntity>(userPage.GetDataSource(), userPage.GetHead())); }