public ISheetWriteContext CrateSheet <T>(string sheetName, uint autoSplit = 1048200) where T : class, new() { var sortedProps = ReflectionHelper.NewInstance.GetSortedExportProps <T>(); var sheet = MultiStageExporter.CreteSheet(_fileId, sheetName, sortedProps.Select(t => t.attr).ToList()); return(new SheetWriteContext(_fileId, autoSplit, sheet)); }
public ISheetWriteContext CrateSheet(string sheetName, List <ExcelKitAttribute> headers, uint autoSplit = 1048200) { Inspector.NotNullAndHasElement(headers, "动态表头信息不能为空"); Inspector.Validation(headers.Count(t => string.IsNullOrWhiteSpace(t.Code)) > 0, "表头信息中存在Code为空的列字段"); Inspector.Validation(headers.Count(t => string.IsNullOrWhiteSpace(t.Desc)) > 0, "表头信息中存在Desc为空的列字段"); headers = headers.Where(t => t.IsIgnore == false).ToList(); headers.RemoveAll(t => t.IsOnlyIgnoreWrite); var sheet = MultiStageExporter.CreteSheet(_fileId, sheetName, headers); return(new SheetWriteContext(_fileId, autoSplit, sheet)); }