yl
2022-07-27 2f91cbefebb537819abc851a3c17a08c691055f4
VueWebApi/Tools/ImportExcel.cs
@@ -53,6 +53,10 @@
            ISheet sheet = Workbook.GetSheetAt(0);
            //第一行为标题行
            IRow headerRow = sheet.GetRow(0);
            if (headerRow == null)
            {
                return table;
            }
            int cellCount = headerRow.LastCellNum;
            int rowCount = sheet.LastRowNum;
@@ -68,7 +72,7 @@
            {
                IRow row = sheet.GetRow(i);
                DataRow dataRow = table.NewRow();
                if (row != null)
                if (row != null&&row.Cells.Count>0)
                {
                    for (int j = row.FirstCellNum; j < cellCount; j++)
                    {
@@ -146,6 +150,10 @@
                ISheet sheet = Workbook.GetSheetAt(0);
                //第一行为标题行
                IRow headerRow = sheet.GetRow(0);
                if (headerRow == null)
                {
                   return list;
                }
                int cellCount = headerRow.LastCellNum;
                int rowCount = sheet.LastRowNum;
@@ -161,7 +169,7 @@
                {
                    IRow row = sheet.GetRow(i);
                    DataRow dataRow = table.NewRow();
                    if (row != null)
                    if (row != null&&row.Cells.Count>0)
                    {
                        for (int j = row.FirstCellNum; j < cellCount; j++)
                        {
@@ -198,13 +206,17 @@
            }
            else
            {
                for (int m = 0; m < 2; m++)
                for (int m = 0; m < count; m++)
                {
                    DataTable table = new DataTable();
                    //定位在第一个sheet
                    ISheet sheet = Workbook.GetSheetAt(m);
                    //第一行为标题行
                    IRow headerRow = sheet.GetRow(0);
                    if (headerRow == null)
                    {
                        return list;
                    }
                    int cellCount = headerRow.LastCellNum;
                    int rowCount = sheet.LastRowNum;
@@ -220,7 +232,7 @@
                    {
                        IRow row = sheet.GetRow(i);
                        DataRow dataRow = table.NewRow();
                        if (row != null)
                        if (row != null&&row.Cells.Count>0)
                        {
                            for (int j = row.FirstCellNum; j < cellCount; j++)
                            {