Пример #1
0
        public static byte[] ExportToBuffer(string templateFile, params SheetRenderer[] sheetRenderers)
        {
            var             str             = Path.GetExtension(templateFile);
            IWorkbookLoader workbookLoader  = Configurator.Get(str);
            IWorkbook       workbook        = workbookLoader.Load(templateFile);
            var             workbookContext = new WorkbookContext(workbook);

            foreach (SheetRenderer sheetRenderer in sheetRenderers)
            {
                sheetRenderer.Render(workbookContext);
            }
            return(workbook.SaveToBuffer());
        }
Пример #2
0
        public IExcelMapper Build(string path, MapperSettings settings)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            var workbook = _workbookLoader.Load(path);

            return(Build(workbook, settings));
        }