1. 读取xlsx
private static FormulaEvaluator evaluator;
String static void readXlsx(String path) {
try{
FileInputStream is = new FileInputStream(path);
Workbook xwb = new XSSFWorkbook(is);
for(int numSheet = 0; numSheet < xwb.getNumberOfSheets(); numSheet++) {
Sheet sheet = xwb.getSheetAt(numSheet);
if(sheet == null) {
continue;
}
for(int numRow = 0; numRow <= sheet.getLastRowNum(); numRow++) {
Row row = sheet.getRow(numRow);
if(row == null) {
continue;
}
for(int numCell = 0; numCell < row.getLastCellNum(); numCell++) {
Cell cell = row.getCell(numCell);
if(cell == null) {
continue;
}
System.out.println("xlsx表格中读取的数据" + getValue(cell));
}
}
}
}catch(Exception e) {
e.printStackTrace();
}
}
public s