e
This commit is contained in:
parent
d071779de8
commit
5e0ddde4ec
@ -159,10 +159,40 @@ public class CaseplatformCaseExcelController {
|
|||||||
// 写数据
|
// 写数据
|
||||||
writer.write(processedList, writeSheet);
|
writer.write(processedList, writeSheet);
|
||||||
|
|
||||||
// 创建合计行(在数据写入后,finish 之前)
|
// 设置标题和合计行(在数据写入后,finish 之前)
|
||||||
try {
|
try {
|
||||||
Workbook workbook = writer.writeContext().writeWorkbookHolder().getWorkbook();
|
Workbook workbook = writer.writeContext().writeWorkbookHolder().getWorkbook();
|
||||||
Sheet sheet = workbook.getSheetAt(0);
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
|
||||||
|
// 确保标题行存在并设置标题
|
||||||
|
Row titleRow = sheet.getRow(0);
|
||||||
|
if (titleRow == null) {
|
||||||
|
titleRow = sheet.createRow(0);
|
||||||
|
}
|
||||||
|
titleRow.setHeightInPoints(30);
|
||||||
|
Cell titleCell = titleRow.getCell(0);
|
||||||
|
if (titleCell == null) {
|
||||||
|
titleCell = titleRow.createCell(0);
|
||||||
|
}
|
||||||
|
titleCell.setCellValue("人工肝诊疗病例征集项目专家劳务费表");
|
||||||
|
|
||||||
|
// 合并标题单元格
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, head.size() - 1));
|
||||||
|
|
||||||
|
// 设置标题样式
|
||||||
|
CellStyle titleStyle = workbook.createCellStyle();
|
||||||
|
Font titleFont = workbook.createFont();
|
||||||
|
titleFont.setFontHeightInPoints((short) 16);
|
||||||
|
titleFont.setBold(true);
|
||||||
|
titleStyle.setFont(titleFont);
|
||||||
|
titleStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||||
|
titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
titleStyle.setBorderBottom(BorderStyle.THIN);
|
||||||
|
titleStyle.setBorderTop(BorderStyle.THIN);
|
||||||
|
titleStyle.setBorderLeft(BorderStyle.THIN);
|
||||||
|
titleStyle.setBorderRight(BorderStyle.THIN);
|
||||||
|
titleCell.setCellStyle(titleStyle);
|
||||||
|
|
||||||
int totalRowIndex = 2 + processedList.size(); // 0=大标题,1=表头,2~1+size=数据,2+size=合计
|
int totalRowIndex = 2 + processedList.size(); // 0=大标题,1=表头,2~1+size=数据,2+size=合计
|
||||||
|
|
||||||
Row totalRow = null;
|
Row totalRow = null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user