public static ExcelFile Read(System.IO.Stream inputStream, ExcelFileType type) { ExcelFile file; switch (type) { case ExcelFileType.XLS: file = new NpoiExcelFile(inputStream); break; case ExcelFileType.XLSX: file = new EPPlusExcelFile(inputStream); break; default: throw new InvalidOperationException(); } return file; }
public static ExcelFile Create(ExcelFileType type) { ExcelFile newFile; switch (type) { case ExcelFileType.XLS: newFile = new NpoiExcelFile(); break; case ExcelFileType.XLSX: newFile = new EPPlusExcelFile(); break; default: throw new InvalidOperationException(); } return newFile; }