Example #1
0
        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));
        }
Example #2
0
        public void AppendData(string sheetName, Dictionary <string, object> rowData)
        {
            if (rowData == null || rowData.Count == 0)
            {
                return;
            }

            MultiStageExporter.AppendData(_fileId, sheetName, rowData, _autoSplit);
        }
Example #3
0
        public void AppendData <T>(string sheetName, T rowData) where T : class, new()
        {
            if (rowData == null)
            {
                return;
            }

            MultiStageExporter.AppendData(_fileId, sheetName, rowData, _autoSplit);
        }
Example #4
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            MultiStageExporter.Dispose(_fileId);
            GC.SuppressFinalize(this);
        }
Example #5
0
        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));
        }
Example #6
0
 public string Save(string saveForder = null)
 {
     return(MultiStageExporter.Save(_fileId, saveForder));
 }
Example #7
0
 public OutExcelInfo Generate()
 {
     return(MultiStageExporter.Generate(_fileId));
 }
Example #8
0
 public string SafeSheetName(string sheetName)
 {
     return(MultiStageExporter.SafeSheetName(sheetName));
 }
Example #9
0
 public ExcelWriteContext(string fileName)
 {
     _fileId = MultiStageExporter.CreateExcel(fileName);
 }