using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System.IO;
namespace YBEE.EQM.Core;
///
/// Excel操作工具
///
public static class ExcelUtil
{
///
/// 获取 Workbook 实例
///
///
///
///
public static IWorkbook GetWorkbook(string filePath, FileStream fileStream)
{
string fileExt = Path.GetExtension(filePath).ToLower();
if (fileExt == ".xls")
{
return new HSSFWorkbook(fileStream);
}
else
{
return new XSSFWorkbook(fileStream);
}
}
///
/// 创建 Workbook
///
///
///
public static IWorkbook GetWorkbook(string filePath)
{
string fileExt = Path.GetExtension(filePath).ToLower();
if (fileExt == ".xls")
{
return new HSSFWorkbook();
}
else
{
return new XSSFWorkbook();
}
}
}