public static IWorkbook Create(string fileName) { if (ExcelCom.IsExcel2007(fileName)) { return(new XSSFWorkbook()); } if (ExcelCom.IsExcel2003(fileName)) { return(new HSSFWorkbook()); } return(null); }
public static IWorkbook CreateInputWorkbook(string fileName) { using (FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { if (ExcelCom.IsExcel2007(fileName)) { return(new XSSFWorkbook(fileStream)); } if (ExcelCom.IsExcel2003(fileName)) { return(new HSSFWorkbook(fileStream)); } } return(null); }