|
@@ -3,6 +3,7 @@ package com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.utils;
|
|
import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.entity.*;
|
|
import com.jeeplus.modules.cg.reservemanagementcenter.reserveManage.entity.*;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
+import org.apache.poi.ss.usermodel.CellStyle;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
@@ -260,11 +261,11 @@ public class ReserveProcessProjectExportUtil {
|
|
|
|
|
|
String excelName = "";
|
|
String excelName = "";
|
|
if (reserveManagement.getHotLineWork().equals("否")){
|
|
if (reserveManagement.getHotLineWork().equals("否")){
|
|
- Row nameRow = sheet.createRow(2);
|
|
|
|
- Row gcRow = sheet.createRow(4);
|
|
|
|
- Row btdyyRow = sheet.createRow(6);
|
|
|
|
- Row btdfaRow = sheet.createRow(10);
|
|
|
|
- Row ckrRow = sheet.createRow(18);
|
|
|
|
|
|
+ Row nameRow = sheet.createRow(3);
|
|
|
|
+ Row gcRow = sheet.createRow(5);
|
|
|
|
+ Row btdyyRow = sheet.createRow(7);
|
|
|
|
+ Row btdfaRow = sheet.createRow(11);
|
|
|
|
+ Row ckrRow = sheet.createRow(19);
|
|
|
|
|
|
Cell nameCell = crateCellNew(workbook,nameRow,0); //项目名称
|
|
Cell nameCell = crateCellNew(workbook,nameRow,0); //项目名称
|
|
Cell gcCell = crateCellNew(workbook,gcRow,0); //工程内容
|
|
Cell gcCell = crateCellNew(workbook,gcRow,0); //工程内容
|
|
@@ -273,6 +274,7 @@ public class ReserveProcessProjectExportUtil {
|
|
Cell ckrCell = crateCellNew(workbook,ckrRow,0); //现场查勘人
|
|
Cell ckrCell = crateCellNew(workbook,ckrRow,0); //现场查勘人
|
|
Cell bzrCell = crateCellNew(workbook,ckrRow,2); //方案编制人
|
|
Cell bzrCell = crateCellNew(workbook,ckrRow,2); //方案编制人
|
|
|
|
|
|
|
|
+
|
|
nameCell.setCellValue("项目名称");
|
|
nameCell.setCellValue("项目名称");
|
|
gcCell.setCellValue("工程内容");
|
|
gcCell.setCellValue("工程内容");
|
|
btdyyCell.setCellValue("无法不停电作业原因");
|
|
btdyyCell.setCellValue("无法不停电作业原因");
|
|
@@ -294,6 +296,13 @@ public class ReserveProcessProjectExportUtil {
|
|
ckrCell2.setCellValue(reserveManagement.getSiteSurveyor());
|
|
ckrCell2.setCellValue(reserveManagement.getSiteSurveyor());
|
|
bzrCell2.setCellValue(reserveManagement.getPlanner());
|
|
bzrCell2.setCellValue(reserveManagement.getPlanner());
|
|
excelName = "镇江公司设计阶段停电作业查勘单.xlsx";
|
|
excelName = "镇江公司设计阶段停电作业查勘单.xlsx";
|
|
|
|
+
|
|
|
|
+ // 指定要添加边框的行和列范围
|
|
|
|
+ int startRow = 3; // 起始行
|
|
|
|
+ int endRow = 19; // 结束行
|
|
|
|
+ int endColumn = 3; // 结束列
|
|
|
|
+
|
|
|
|
+ setCellStyle(workbook,startRow,endRow,sheet,endColumn);
|
|
}else {
|
|
}else {
|
|
Row nameRow = sheet.createRow(2);
|
|
Row nameRow = sheet.createRow(2);
|
|
Row gcRow = sheet.createRow(4);
|
|
Row gcRow = sheet.createRow(4);
|
|
@@ -330,6 +339,13 @@ public class ReserveProcessProjectExportUtil {
|
|
bzrCell2.setCellValue(reserveManagement.getPlanner());
|
|
bzrCell2.setCellValue(reserveManagement.getPlanner());
|
|
|
|
|
|
excelName = "镇江公司设计阶段不停电作业查勘单.xlsx";
|
|
excelName = "镇江公司设计阶段不停电作业查勘单.xlsx";
|
|
|
|
+
|
|
|
|
+ // 指定要添加边框的行和列范围
|
|
|
|
+ int startRow = 2; // 起始行
|
|
|
|
+ int endRow = 16; // 结束行
|
|
|
|
+ int endColumn = 3; // 结束列
|
|
|
|
+
|
|
|
|
+ setCellStyle(workbook,startRow,endRow,sheet,endColumn);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1362,8 +1378,29 @@ public class ReserveProcessProjectExportUtil {
|
|
style.setAlignment(XSSFCellStyle.ALIGN_CENTER); //水平居中
|
|
style.setAlignment(XSSFCellStyle.ALIGN_CENTER); //水平居中
|
|
style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); //垂直居中
|
|
style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); //垂直居中
|
|
style.setWrapText(true);//自动换行
|
|
style.setWrapText(true);//自动换行
|
|
-
|
|
|
|
|
|
+ style.setBorderLeft(XSSFCellStyle.BORDER_THIN); // 左边框细线
|
|
|
|
+ style.setBorderRight(XSSFCellStyle.BORDER_THIN); // 右边框细线
|
|
|
|
+ style.setBorderBottom(XSSFCellStyle.BORDER_THIN); // 下边框细线
|
|
cell.setCellStyle(style);
|
|
cell.setCellStyle(style);
|
|
return cell;
|
|
return cell;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public void setCellStyle(XSSFWorkbook workbook,int startRow,int endRow,Sheet sheet,int endColumn ){
|
|
|
|
+ XSSFCellStyle newStyle = workbook.createCellStyle();
|
|
|
|
+ newStyle.setBorderRight(XSSFCellStyle.BORDER_THIN); // 右边框细线
|
|
|
|
+ newStyle.setBorderBottom(XSSFCellStyle.BORDER_THIN); // 下边框细线
|
|
|
|
+ // 循环遍历指定的行和列范围,为每个单元格应用边框样式
|
|
|
|
+ for (int rowIndex = startRow; rowIndex <= endRow; rowIndex++) {
|
|
|
|
+ Row row = sheet.getRow(rowIndex);
|
|
|
|
+ if (row == null) {
|
|
|
|
+ row = sheet.createRow(rowIndex);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Cell cell = row.createCell(endColumn);
|
|
|
|
+ cell.setCellValue(""); // 如果需要在单元格中填充数据
|
|
|
|
+
|
|
|
|
+ // 将样式应用到指定的单元格
|
|
|
|
+ cell.setCellStyle(newStyle);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|