打表工具优化

back_recharge
duhui 2021-05-13 11:47:17 +08:00
parent 1d8fea9f96
commit e494248bd3
1 changed files with 4 additions and 19 deletions

View File

@ -1,14 +1,12 @@
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.*;
import java.util.*;
public class ExcelUtils {
private static boolean isWrite = true;
private static String excelPath ="E:\\work\\data_execl\\master_en\\base_data\\"; //excel 文件
private static String excelPath ="D:\\A-duhui\\project\\data_execl\\master_zh_c\\base_data\\"; //excel 文件
// private static String excelPath ="D:/excel/0.94/data_execl/Map_data/"; //excel 文件
private static String path = "conf/server/";
private static Set<String> oldFileNames = new HashSet<>();
@ -363,29 +361,16 @@ public class ExcelUtils {
//读取excel
private static Workbook readExcel(String filePath) {
Workbook wb = null;
if (filePath == null) {
return null;
}
String extString = filePath.substring(filePath.lastIndexOf("."));
InputStream is;
try {
is = new FileInputStream(filePath);
if (".xls".equals(extString)) {
return wb = new HSSFWorkbook(is);
} else if (".xlsx".equals(extString)) {
wb = new XSSFWorkbook(is);
return wb;
} else {
return wb = null;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
InputStream is = new FileInputStream(filePath);
return WorkbookFactory.create(is);
} catch (Exception e) {
e.printStackTrace();
}
return wb;
return null;
}
public static Object getCellFormatValue(Cell cell,Cell cellType) {