main
黄海 8 months ago
parent d16e2e2495
commit 734c320ca6

@ -89,12 +89,13 @@ public class A8 {
System.out.println("发现异常数据,请人工处理:" + file.getName()); System.out.println("发现异常数据,请人工处理:" + file.getName());
System.exit(0); System.exit(0);
} }
//县区名称
//System.out.println("正在进行" + cityName + "-" + areaName + "的数据填充~");
int firstChartNumber = 1; int firstChartNumber = 1;
List<List<String>> source1 = List<List<String>> source1 =
ExcelKit.getChartData(file.getAbsolutePath(), firstChartNumber - 1, 6);//从2017年开始 ExcelKit.getChartData(file.getAbsolutePath(), firstChartNumber - 1, 6);//从2017年开始
//县区名称
System.out.println("正在进行" + cityName + "-" + areaName + "的数据填充~");
} }
} }
//保存文件 //保存文件

@ -141,8 +141,6 @@ public class ExcelKit {
// 遍历工作表中的所有行 // 遍历工作表中的所有行
if (sheet == null) return array; if (sheet == null) return array;
System.out.println("readSheet数据数量=" + sheet.getLastRowNum());
for (Row row : sheet) { for (Row row : sheet) {
rowIndex++; rowIndex++;
if (rowIndex <= skipRowCount) continue;//跳过指定的行数 if (rowIndex <= skipRowCount) continue;//跳过指定的行数
@ -361,8 +359,8 @@ public class ExcelKit {
List<List<String>> data = ExcelKit.readSheet(workbook, skipRowCount); List<List<String>> data = ExcelKit.readSheet(workbook, skipRowCount);
is.close(); is.close();
if (data.isEmpty()) { if (data.isEmpty()) {
System.out.println("第" + (chartNumber + 1) + "个图表Sheet个数="+workbook.getNumberOfSheets()+",Sheet名称="+workbook.getSheetAt(0).getSheetName()+",数据为空,请检查表格是否为空"); System.out.println(docPath + ",第" + (chartNumber + 1) + "个图表,存在数据外链接情况,请人为处理!");
System.exit(-1); // System.exit(-1);
} }
return data; return data;
} }
@ -489,7 +487,7 @@ public class ExcelKit {
} }
} }
public static void ReadChart(String sourceWord) throws IOException, InvalidFormatException { public static void ReadChart(String sourceWord) throws IOException, InvalidFormatException {
InputStream is = new FileInputStream(sourceWord); InputStream is = new FileInputStream(sourceWord);
ZipSecureFile.setMinInflateRatio(-1.0d); ZipSecureFile.setMinInflateRatio(-1.0d);
XWPFDocument doc = new XWPFDocument(is); XWPFDocument doc = new XWPFDocument(is);

Loading…
Cancel
Save