|
|
@ -146,6 +146,16 @@ public class ExportExcel {
|
|
|
|
districtMergeStartRow, rowNum - 1, 0, 0));
|
|
|
|
districtMergeStartRow, rowNum - 1, 0, 0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 合并表头中的"年份"列
|
|
|
|
|
|
|
|
sheet.addMergedRegion(new CellRangeAddress(0, 0, 1, 2));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 为合并后的单元格重新设置样式(避免合并后样式丢失)
|
|
|
|
|
|
|
|
Cell mergedCell = headerRow.getCell(1);
|
|
|
|
|
|
|
|
if (mergedCell != null) {
|
|
|
|
|
|
|
|
mergedCell.setCellValue("年份");
|
|
|
|
|
|
|
|
mergedCell.setCellStyle(headerStyle);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 保存文件
|
|
|
|
// 保存文件
|
|
|
|
try (FileOutputStream fileOut = new FileOutputStream(filePath)) {
|
|
|
|
try (FileOutputStream fileOut = new FileOutputStream(filePath)) {
|
|
|
|
workbook.write(fileOut);
|
|
|
|
workbook.write(fileOut);
|
|
|
|