public bool readExcel(string path, ref Dictionary<int, int> dic)
{
if (!File.Exists(path))
{
Console.WriteLine("未找到Excel文件");
return false;
}
try
{
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
IWorkbook wk = new HSSFWorkbook(fs);
ISheet sheet = wk.GetSheetAt(0);
if (sheet.LastRowNum == 0)
{
Console.WriteLine(sheet.SheetName + "为空,请检查文档内容");
return false;
}
int row = sheet.LastRowNum;
for (int i = 0; i < row; i++)
{
if (i > 1)
{
IRow curRow = sheet.G
简单实用nopi 读取 excel表格(注意是.xls格式的 )
最新推荐文章于 2024-07-29 15:07:13 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)