|
|
|
@ -1,54 +0,0 @@
|
|
|
|
|
package com.dsideal.base.Tools.FillData.Test;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import com.dsideal.base.Tools.FillData.ExcelKit.ExcelKit;
|
|
|
|
|
import com.dsideal.base.Tools.Util.LocalMysqlConnectUtil;
|
|
|
|
|
import com.dsideal.base.Tools.Util.ReadDocxUtil;
|
|
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class C2 {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws IOException, InvalidFormatException, InterruptedException {
|
|
|
|
|
//初始化数据库连接
|
|
|
|
|
LocalMysqlConnectUtil.Init();
|
|
|
|
|
//实例化
|
|
|
|
|
ReadDocxUtil ru = new ReadDocxUtil();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//处理这个目录
|
|
|
|
|
//判断file是不是目录,是目录的需要跳过
|
|
|
|
|
//城市名称
|
|
|
|
|
File file = new File("D:\\dsWork\\YunNanDsBase\\Doc\\全省及州市县区人口与教育报告集20241023\\16个州市报告2022\\分析报告20240510\\昭通市人口变化及其对教育的影响20240416.docx");
|
|
|
|
|
String cityName = ru.getCityOrAreaName(file.getName());
|
|
|
|
|
String fileName = file.getName();
|
|
|
|
|
|
|
|
|
|
//判断是否为docx文件
|
|
|
|
|
if (fileName.endsWith(".docx") && !fileName.startsWith("~")) {
|
|
|
|
|
System.out.println("正在处理" + cityName + "市州文件...");
|
|
|
|
|
//读取文件
|
|
|
|
|
|
|
|
|
|
//1号模板,数据在图表6和29中
|
|
|
|
|
int secondChartNumber = 29;
|
|
|
|
|
List<List<String>> source2 = ExcelKit.getChartData(file.getAbsolutePath(), secondChartNumber - 1, 1, 10);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < source2.size(); i++) {
|
|
|
|
|
System.out.println(source2.get(i).size());
|
|
|
|
|
for (int j = 0; j < source2.get(i).size(); j++) {
|
|
|
|
|
System.out.print(source2.get(i).get(j) + "\t");
|
|
|
|
|
}
|
|
|
|
|
System.out.println();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|