main
黄海 8 months ago
parent 3dcf9c0b20
commit caf36d6f1a

@ -84,11 +84,15 @@ public class A12 {
//县区名称
System.out.println("正在进行" + cityName + "-" + areaName + "的数据填充~");
int chartNumber = 36;
List<List<String>> source36 = ExcelKit.getChartData(file.getAbsolutePath(), chartNumber , 6);//从2017年开始
List<List<String>> source36 = ExcelKit.getChartData(file.getAbsolutePath(), chartNumber, 1);
if (source36 == null) {
System.out.println("skipRowCount is too big, please check your data.");
}
chartNumber = 37;
List<List<String>> source37 = ExcelKit.getChartData(file.getAbsolutePath(), chartNumber, 6);//从2017年开始
List<List<String>> source37 = ExcelKit.getChartData(file.getAbsolutePath(), chartNumber, 1);
if (source37 == null) {
System.out.println("skipRowCount is too big, please check your data.");
}
}
}
//保存文件

@ -360,8 +360,7 @@ public class ExcelKit {
public static List<List<String>> getChartData(String docPath, int chartNumber, int skipRowCount) throws IOException, InvalidFormatException, InterruptedException, DocumentException {
List<List<String>> data = readChart(docPath, chartNumber);
//需要跳过前skipRowCount行先要判断一下是不是够跳的不够跳的直接输出错误
if (data.size() < skipRowCount) {
System.out.println("skipRowCount is too big, please check your data.");
if (data==null ||data.size() < skipRowCount) {
return null;
}
//截取部分数据返回
@ -562,9 +561,15 @@ public class ExcelKit {
// 处理barChart或lineChart节点
//System.out.println("找到图表类型:" + child.getName());
String type = child.getName();
Element q = root.element("chart").element("plotArea").element(type)
.element("ser").element("cat").element("numRef");
xList = q.element("numCache").elements("pt");
Element q = root.element("chart");
q = q.element("plotArea");
q = q.element(type);
q = q.element("ser");
q = q.element("cat");
if (q == null) return null;
q = q.element("numRef");
q = q.element("numCache");
xList = q.elements("pt");
List<Object> listObject = new ArrayList<>();
///c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:val/c:numRef/c:numCache

Loading…
Cancel
Save