コード例 #1
0
        public Workbook CreateWorkbook(byte[] buffer, CExcelVersion excelVersion = CExcelVersion.Version2007)
        {
            var workbook = CreateWorkbook(excelVersion);

            workbook.LoadFromStream(new MemoryStream(buffer));
            return(workbook);
        }
コード例 #2
0
        public Workbook CreateWorkbook(string filename, CExcelVersion excelVersion = CExcelVersion.Version2007)
        {
            var workbook = CreateWorkbook(excelVersion);

            workbook.LoadFromFile(filename);
            return(workbook);
        }
コード例 #3
0
        public Workbook CreateWorkbook(Stream sm, CExcelVersion excelVersion = CExcelVersion.Version2007)
        {
            var workbook = CreateWorkbook(excelVersion);

            workbook.LoadFromStream(sm);
            return(workbook);
        }
コード例 #4
0
        public IWorkbook CreateWorkbook(byte[] buffer, CExcelVersion excelVersion = CExcelVersion.Version2007)
        {
            IWorkbook workbook = null;

            if (excelVersion == CExcelVersion.Version2003)
            {
                workbook = new HSSFWorkbook(new MemoryStream(buffer));
            }
            else
            {
                workbook = new XSSFWorkbook(new MemoryStream(buffer));
            }
            return(workbook);
        }
コード例 #5
0
        public IWorkbook CreateWorkbook(Stream sm, CExcelVersion excelVersion = CExcelVersion.Version2007)
        {
            IWorkbook workbook = null;

            if (excelVersion == CExcelVersion.Version2003)
            {
                workbook = new HSSFWorkbook(sm);
            }
            else
            {
                workbook = new XSSFWorkbook(sm);
            }
            return(workbook);
        }
コード例 #6
0
        public IWorkbook CreateWorkbook(string filename, CExcelVersion excelVersion = CExcelVersion.Version2007)
        {
            IWorkbook workbook = null;

            if (excelVersion == CExcelVersion.Version2003)
            {
                var fs = File.OpenRead(filename);
                workbook = new HSSFWorkbook(fs);
            }
            else
            {
                workbook = new XSSFWorkbook(filename);
            }
            return(workbook);
        }
コード例 #7
0
        public Workbook CreateWorkbook(CExcelVersion excelVersion = CExcelVersion.Version2007)
        {
            ExcelVersion version = ExcelVersion.Version2016;

            if (excelVersion == CExcelVersion.Version2003)
            {
                version = ExcelVersion.Version97to2003;
            }
            var workbook = new Workbook()
            {
                Version = version
            };

            workbook.Worksheets.Clear();
            return(workbook);
        }
コード例 #8
0
 public ExcelPackage CreateWorkbook(string filename, CExcelVersion excelVersion = CExcelVersion.Version2007)
 {
     return(new ExcelPackage(new FileInfo(filename)));
 }
コード例 #9
0
 public ExcelPackage CreateWorkbook(byte[] buffer, CExcelVersion excelVersion = CExcelVersion.Version2007)
 {
     return(new ExcelPackage(new MemoryStream(buffer)));
 }
コード例 #10
0
 public ExcelPackage CreateWorkbook(Stream sm, CExcelVersion excelVersion = CExcelVersion.Version2007)
 {
     //
     return(new ExcelPackage(sm));
 }
コード例 #11
0
 public ExcelPackage CreateWorkbook(CExcelVersion excelVersion = CExcelVersion.Version2007)
 {
     return(new ExcelPackage());
 }