admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
fanli/src/main/java/com/yeshi/fanli/util/ExcelUtil.java
@@ -1,39 +1,39 @@
package com.yeshi.fanli.util;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class ExcelUtil {
   public static List<String> articelList(String path) {
      List<String> list = new ArrayList<String>();
      try {
         File file = new File(path); // 创建文件对象
package com.yeshi.fanli.util;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class ExcelUtil {
   public static List<String> articelList(String path) {
      List<String> list = new ArrayList<String>();
      try {
         File file = new File(path); // 创建文件对象
         Workbook wb = Workbook.getWorkbook(file); // 从文件流中获取Excel工作区对象(WorkBook
         Sheet sheet = wb.getSheet(0); // 从工作区中取得页(Sheet
         for (int i = 0; i < sheet.getRows(); i++) { // 循环打印Excel表中的内
            Cell cell = sheet.getCell(1, i);
            if (!StringUtil.isNullOrEmpty(cell.getContents()))
               list.add((cell.getContents() + "").trim());
         }
      } catch (BiffException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      }
      return list;
   }
   public static void updateExcel() {
   }
}
            Cell cell = sheet.getCell(1, i);
            if (!StringUtil.isNullOrEmpty(cell.getContents()))
               list.add((cell.getContents() + "").trim());
         }
      } catch (BiffException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      }
      return list;
   }
   public static void updateExcel() {
   }
}