|
|
|
@ -9,7 +9,7 @@ import java.io.FileOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class GenerateQA {
|
|
|
|
|
public class GenerateQA_1 {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
|
|
|
//数据源
|
|
|
|
@ -20,10 +20,10 @@ public class GenerateQA {
|
|
|
|
|
String target = source.replace(".xlsx", "【结果】.xlsx");
|
|
|
|
|
|
|
|
|
|
//模板读取
|
|
|
|
|
FileInputStream finTemplate = new FileInputStream(template);
|
|
|
|
|
Workbook wbTemplate = new XSSFWorkbook(finTemplate);
|
|
|
|
|
FileInputStream fTemplate = new FileInputStream(template);
|
|
|
|
|
Workbook wbTemplate = new XSSFWorkbook(fTemplate);
|
|
|
|
|
Sheet sheetTemplate = wbTemplate.getSheetAt(0);// 获取第一个工作表
|
|
|
|
|
CellStyle cellStyle = ExcelCommonUtil.getCellStyle(wbTemplate);//单元格样式
|
|
|
|
|
CellStyle style = ExcelCommonUtil.getCellStyle(wbTemplate);//单元格样式
|
|
|
|
|
|
|
|
|
|
//源文件
|
|
|
|
|
FileInputStream fSource = new FileInputStream(source);
|
|
|
|
@ -69,7 +69,7 @@ public class GenerateQA {
|
|
|
|
|
cell = row.createCell(0);
|
|
|
|
|
}
|
|
|
|
|
cell.setCellValue(area + "下的学校列表");
|
|
|
|
|
cell.setCellStyle(cellStyle);
|
|
|
|
|
cell.setCellStyle(style);
|
|
|
|
|
|
|
|
|
|
//(2)回答
|
|
|
|
|
cell = row.getCell(1);
|
|
|
|
@ -85,7 +85,7 @@ public class GenerateQA {
|
|
|
|
|
content = content + ",学校总数:" + areaMap.get(area).size() + "个。" + "\n";
|
|
|
|
|
|
|
|
|
|
cell.setCellValue(content);
|
|
|
|
|
cell.setCellStyle(cellStyle);
|
|
|
|
|
cell.setCellStyle(style);
|
|
|
|
|
|
|
|
|
|
//(3)可选问题名称
|
|
|
|
|
cell = row.getCell(2);
|
|
|
|
@ -93,7 +93,7 @@ public class GenerateQA {
|
|
|
|
|
cell = row.createCell(2);
|
|
|
|
|
}
|
|
|
|
|
cell.setCellValue(area + "下的学校列表");
|
|
|
|
|
cell.setCellStyle(cellStyle);
|
|
|
|
|
cell.setCellStyle(style);
|
|
|
|
|
}
|
|
|
|
|
// 保存文件
|
|
|
|
|
FileOutputStream fileOut = new FileOutputStream(target);
|