main
黄海 9 months ago
parent ae085eccbb
commit 760d3810e7

@ -105,10 +105,7 @@ public class A7 {
//取出第一行 //取出第一行
if (dataList.isEmpty()) continue; if (dataList.isEmpty()) continue;
//入园总数 List<String> stringList = dataList.get(1);
for (List<String> stringList : dataList) {
//年份
int year = Integer.parseInt(stringList.getFirst());
//总人口 //总人口
String zrk = stringList.get(ExcelKit.transLetter2Num("B")).split("\\.")[0]; String zrk = stringList.get(ExcelKit.transLetter2Num("B")).split("\\.")[0];
//城镇人口 //城镇人口
@ -118,18 +115,16 @@ public class A7 {
Row outRow = outSheet.createRow(++rowIndex); Row outRow = outSheet.createRow(++rowIndex);
ExcelKit.putData(outRow, Arrays.asList(areaName, "总人口", zrk, "人", cityName), dataStyle); ExcelKit.putData(outRow, Arrays.asList(areaName, "总人口", zrk, "人", cityName), dataStyle);
outRow = outSheet.createRow(++rowIndex);
ExcelKit.putData(outRow, Arrays.asList(areaName, "新生人口", "0", "人", cityName), dataStyle); ExcelKit.putData(outRow, Arrays.asList(areaName, "新生人口", "0", "人", cityName), dataStyle);
outRow = outSheet.createRow(++rowIndex);
ExcelKit.putData(outRow, Arrays.asList(areaName, "城镇人口", cz, "人", cityName), dataStyle); ExcelKit.putData(outRow, Arrays.asList(areaName, "城镇人口", cz, "人", cityName), dataStyle);
outRow = outSheet.createRow(++rowIndex);
ExcelKit.putData(outRow, Arrays.asList(areaName, "乡村人口", xc, "人", cityName), dataStyle); ExcelKit.putData(outRow, Arrays.asList(areaName, "乡村人口", xc, "人", cityName), dataStyle);
outRow = outSheet.createRow(++rowIndex);
//保留两位小数 //保留两位小数
ExcelKit.putData(outRow, Arrays.asList(areaName, "城镇化率", ExcelKit.putData(outRow, Arrays.asList(areaName, "城镇化率",
String.format("%.2f", Double.parseDouble(cz) / Double.parseDouble(zrk) * 100) + "%", "人", cityName), dataStyle); String.format("%.2f", Double.parseDouble(cz) / Double.parseDouble(zrk) * 100) + "%", "", cityName), dataStyle);
}
} }
} }
//保存文件 //保存文件

Loading…
Cancel
Save