|
|
@@ -11,38 +11,56 @@ import java.io.InputStream;
|
|
|
import java.math.BigInteger;
|
|
|
import java.util.List;
|
|
|
|
|
|
+// 新增:勾选项实体类
|
|
|
+class CheckItem {
|
|
|
+ private String parent; // 父项(如:个人防护、规范操作、人员位置等)
|
|
|
+ private String child; // 子项(如:头部、其他、不按规定的方法操作等)
|
|
|
+
|
|
|
+ public CheckItem(String parent, String child) {
|
|
|
+ this.parent = parent;
|
|
|
+ this.child = child;
|
|
|
+ }
|
|
|
+
|
|
|
+ // getter
|
|
|
+ public String getParent() {
|
|
|
+ return parent;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getChild() {
|
|
|
+ return child;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
public class SafetyObservationCardGenerator {
|
|
|
|
|
|
- // 核心入口:支持传入需要打勾的子项列表
|
|
|
- public static void generateCard(List<String> checkedItems) {
|
|
|
+ // 重构:接收勾选列表作为参数
|
|
|
+ public static void generateCard(List<CheckItem> checkItems) {
|
|
|
try (XWPFDocument document = new XWPFDocument();
|
|
|
FileOutputStream out = new FileOutputStream("行为安全观察与沟通卡-数智化.docx")) {
|
|
|
|
|
|
- // 1. 标题:替换为KERUI科瑞石油技术图片
|
|
|
+ // 1. 标题:KERUI科瑞石油技术图片
|
|
|
XWPFParagraph logoPara = document.createParagraph();
|
|
|
- logoPara.setAlignment(ParagraphAlignment.CENTER); // 图片居中
|
|
|
+ logoPara.setAlignment(ParagraphAlignment.CENTER);
|
|
|
XWPFRun logoRun = logoPara.createRun();
|
|
|
|
|
|
- // 读取本地图片并插入(替换为你的图片实际路径)
|
|
|
String imagePath = "pic/keruishiyoujishu.png";
|
|
|
InputStream imageStream = new ClassPathResource(imagePath).getInputStream();
|
|
|
|
|
|
XWPFRun run = logoPara.createRun();
|
|
|
run.addPicture(imageStream, XWPFDocument.PICTURE_TYPE_PNG, "keruishiyoujishu.png",
|
|
|
- Units.toEMU(250), Units.toEMU(30)); // 宽高按需调整
|
|
|
+ Units.toEMU(250), Units.toEMU(30));
|
|
|
|
|
|
document.createParagraph();
|
|
|
|
|
|
- // 2. 创建表格(先创建足够行数,方便后续垂直合并)
|
|
|
- XWPFTable table = document.createTable(9, 3); // 预创建9行3列(标题行+提示行+7行内容)
|
|
|
+ // 2. 创建表格
|
|
|
+ XWPFTable table = document.createTable(9, 3);
|
|
|
table.setWidth("100%");
|
|
|
- // 清空预创建的行(重新自定义行内容)
|
|
|
while (table.getRows().size() > 0) {
|
|
|
table.removeRow(0);
|
|
|
}
|
|
|
table.setWidth("100%");
|
|
|
|
|
|
- // 标题行(文字浅蓝色)
|
|
|
+ // 标题行
|
|
|
XWPFTableRow titleRow = table.createRow();
|
|
|
mergeCellsHorizontally(titleRow, 0, 2);
|
|
|
XWPFTableCell titleCell = titleRow.getCell(0);
|
|
|
@@ -60,102 +78,91 @@ public class SafetyObservationCardGenerator {
|
|
|
setTipTextStyle(headerRow1.getCell(1), "规范操作□", true, ParagraphAlignment.LEFT, "DCE6F1");
|
|
|
setTipTextStyle(headerRow1.getCell(2), "观察描述:", true, ParagraphAlignment.LEFT, "DCE6F1");
|
|
|
|
|
|
- // 行4:个人防护明细 | 规范操作明细 | 空(后续垂直合并)
|
|
|
+ // 行4:个人防护明细 | 规范操作明细 | 空
|
|
|
XWPFTableRow row4 = table.createRow();
|
|
|
- String ppeText = "个人防护用品是否齐全、规范?\n" +
|
|
|
- "□ 头部\n" +
|
|
|
- "□ 脸部及眼部\n" +
|
|
|
- "□ 听力保护\n" +
|
|
|
- "□ 呼吸系统\n" +
|
|
|
- "□ 胳膊和手\n" +
|
|
|
- "□ 躯干\n" +
|
|
|
- "□ 腿部和脚\n" +
|
|
|
- "□ 其他 _______________";
|
|
|
- // 处理个人防护子项勾选
|
|
|
- ppeText = checkItemsInText(ppeText, checkedItems);
|
|
|
-
|
|
|
- String opText = "员工是否严格执行操作规程?\n□ 不按规定的方法操作\n□ 不采取安全措施进行操作\n□ 其他 _______________";
|
|
|
- // 处理规范操作子项勾选
|
|
|
- opText = checkItemsInText(opText, checkedItems);
|
|
|
-
|
|
|
+ // 核心修改:传入勾选列表,自动勾选对应子项
|
|
|
+ String ppeText = getCheckedText("个人防护",
|
|
|
+ "个人防护用品是否齐全、规范?\n" +
|
|
|
+ "□ 头部\n" +
|
|
|
+ "□ 脸部及眼部\n" +
|
|
|
+ "□ 听力保护\n" +
|
|
|
+ "□ 呼吸系统\n" +
|
|
|
+ "□ 胳膊和手\n" +
|
|
|
+ "□ 躯干\n" +
|
|
|
+ "□ 腿部和脚\n" +
|
|
|
+ "□ 其他 _______________",
|
|
|
+ checkItems);
|
|
|
+ String opText = getCheckedText("规范操作",
|
|
|
+ "员工是否严格执行操作规程?\n□ 不按规定的方法操作\n□ 不采取安全措施进行操作\n□ 其他 _______________",
|
|
|
+ checkItems);
|
|
|
setCellStyle(row4.getCell(0), ppeText, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
setCellStyle(row4.getCell(1), opText, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
setCellStyle(row4.getCell(2), "", false, ParagraphAlignment.LEFT, "E6EBF5");
|
|
|
|
|
|
- // 行5:规范指挥 | 人员位置 | 空(后续垂直合并)
|
|
|
+ // 行5:规范指挥 | 人员位置 | 空
|
|
|
XWPFTableRow headerRow2 = table.createRow();
|
|
|
setCellStyle(headerRow2.getCell(0), "规范指挥□", true, ParagraphAlignment.LEFT, "DCE6F1");
|
|
|
setCellStyle(headerRow2.getCell(1), "人员位置□", true, ParagraphAlignment.LEFT, "DCE6F1");
|
|
|
setCellStyle(headerRow2.getCell(2), "", false, ParagraphAlignment.LEFT, "E6EBF5");
|
|
|
|
|
|
+ // 行6:规范指挥明细 | 人员位置明细 | 安全行为描述
|
|
|
XWPFTableRow row10 = table.createRow();
|
|
|
- String cmdText1 = "是否违章指挥?\n□ 指挥信号不正确/不清楚\n□ 多人指挥,信号不统一\n□ 非特殊情况下越权指挥\n□ 明知危险仍强令冒险作业\n□ 特殊作业前没有进行作业申请/风险分析\n□ 其他 _______________";
|
|
|
- // 处理规范指挥子项勾选
|
|
|
- cmdText1 = checkItemsInText(cmdText1, checkedItems);
|
|
|
-
|
|
|
- String posText1 = "人员站位是否安全?\n□ 碰撞到物体\n□ 被物体夹住/手扶握物体部位不正确\n□ 跌倒/坠落/陷入物体之中\n□ 被物体砸到\n□ 接触极高/极低温度/电流/电击\n□ 吸入/吸收/吞食有害物质\n□ 姿势不良/用力过度\n□ 其他 _______________";
|
|
|
- // 处理人员位置子项勾选
|
|
|
- posText1 = checkItemsInText(posText1, checkedItems);
|
|
|
-
|
|
|
+ String cmdText1 = getCheckedText("规范指挥",
|
|
|
+ "是否违章指挥?\n□ 指挥信号不正确/不清楚\n□ 多人指挥,信号不统一\n□ 非特殊情况下越权指挥\n□ 明知危险仍强令冒险作业\n□ 特殊作业前没有进行作业申请/风险分析\n□ 其他 _______________",
|
|
|
+ checkItems);
|
|
|
+ String posText1 = getCheckedText("人员位置",
|
|
|
+ "人员站位是否安全?\n□ 碰撞到物体\n□ 被物体夹住/手扶握物体部位不正确\n□ 跌倒/坠落/陷入物体之中\n□ 被物体砸到\n□ 接触极高/极低温度/电流/电击\n□ 吸入/吸收/吞食有害物质\n□ 姿势不良/用力过度\n□ 其他 _______________",
|
|
|
+ checkItems);
|
|
|
String safeText1 = "·观察到的安全行为或安全状态\n·鼓励安全行为或安全状态所采取的行动";
|
|
|
setCellStyle(row10.getCell(0), cmdText1, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
setCellStyle(row10.getCell(1), posText1, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
setCellStyle(row10.getCell(2), safeText1, true, ParagraphAlignment.LEFT, "E6EBF5");
|
|
|
|
|
|
- // 行6:规范指挥明细 | 人员位置明细 | 安全行为描述(后续垂直合并)
|
|
|
+ // 行7:规范指挥明细 | 人员位置明细 | 安全行为描述
|
|
|
XWPFTableRow row6 = table.createRow();
|
|
|
setRowHeight(row6, 1900);
|
|
|
- String cmdText = "";
|
|
|
- String posText = "";
|
|
|
- String safeText = "";
|
|
|
- setCellStyle(row6.getCell(0), cmdText, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
- setCellStyle(row6.getCell(1), posText, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
- setCellStyle(row6.getCell(2), safeText, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
-
|
|
|
- // 行7:规范指挥明细 | 人员位置明细 | 安全行为描述(后续垂直合并)
|
|
|
+ setCellStyle(row6.getCell(0), "", false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
+ setCellStyle(row6.getCell(1), "", false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
+ setCellStyle(row6.getCell(2), "", false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
+
|
|
|
+ // 行8:规范指挥明细 | 人员位置明细 | 不安全行为描述
|
|
|
XWPFTableRow row7 = table.createRow();
|
|
|
setRowHeight(row7, 500);
|
|
|
- String cmdText2 = "";
|
|
|
- String posText2 = "";
|
|
|
String safeText2 = "·观察到的不安全行为或不安全状态\n·即刻的纠正行动\n·预防再发生的行动";
|
|
|
- setCellStyle(row7.getCell(0), cmdText2, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
- setCellStyle(row7.getCell(1), posText2, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
+ setCellStyle(row7.getCell(0), "", false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
+ setCellStyle(row7.getCell(1), "", false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
setCellStyle(row7.getCell(2), safeText2, true, ParagraphAlignment.LEFT, "E6EBF5");
|
|
|
|
|
|
- // 行7:作业场所 | 空 | 空(后续垂直合并)
|
|
|
+ // 行9:作业场所 | 空 | 空
|
|
|
XWPFTableRow headerRow3 = table.createRow();
|
|
|
mergeCellsHorizontally(headerRow3, 0, 1);
|
|
|
setCellStyle(headerRow3.getCell(0), "作业场所□ \n作业场所、工作环境是否存在不安全状态或其他安全隐患?", true, ParagraphAlignment.LEFT, "DCE6F1");
|
|
|
setCellStyle(headerRow3.getCell(2), "", false, ParagraphAlignment.LEFT, "E6EBF5");
|
|
|
|
|
|
- // 行8:作业场所明细 | 空 | 不安全行为描述(后续垂直合并)
|
|
|
+ // 行10:作业场所明细 | 空 | 不安全行为描述
|
|
|
XWPFTableRow row8 = table.createRow();
|
|
|
- String houseText = "□ 作业场所杂乱\n□ 作业空间狭小\n□ 堵塞安全通道\n□ 地面滑(水/雨/雪/油污等)\n□ 物体/工具放置位置不当 \n□ 危险场所没有标志/标志不清\n□ 照明光线不良";
|
|
|
- // 处理作业场所子项勾选
|
|
|
- houseText = checkItemsInText(houseText, checkedItems);
|
|
|
-
|
|
|
- String secondText = "□ 带电装置带电部分裸露\n□ 设备无防护/防护装置不当\n□ 未工完料净场地清/垃圾未分类存放\n□ 通风不良/氧气含量未达标\n□ 其他 _______________";
|
|
|
- // 处理作业场所子项勾选
|
|
|
- secondText = checkItemsInText(secondText, checkedItems);
|
|
|
-
|
|
|
- String unsafeText = "";
|
|
|
+ String houseText = getCheckedText("作业场所",
|
|
|
+ "□ 作业场所杂乱\n□ 作业空间狭小\n□ 堵塞安全通道\n□ 地面滑(水/雨/雪/油污等)\n□ 物体/工具放置位置不当 \n□ 危险场所没有标志/标志不清\n□ 照明光线不良",
|
|
|
+ checkItems);
|
|
|
+ String secondText = getCheckedText("作业场所",
|
|
|
+ "□ 带电装置带电部分裸露\n□ 设备无防护/防护装置不当\n□ 未工完料净场地清/垃圾未分类存放\n□ 通风不良/氧气含量未达标\n□ 其他 _______________",
|
|
|
+ checkItems);
|
|
|
setCellStyle(row8.getCell(0), houseText, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
setCellStyle(row8.getCell(1), secondText, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
- setCellStyle(row8.getCell(2), unsafeText, false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
+ setCellStyle(row8.getCell(2), "", false, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
|
|
|
// 底部信息行
|
|
|
XWPFTableRow footerRow = table.createRow();
|
|
|
mergeCellsHorizontally(footerRow, 0, 2);
|
|
|
String footerText = "观察区域: ____________ 实施观察人员: ____________ 被观察岗位:____________ \n被观察人员:□员工 □承包商 □供应商 日期: __________ 时间:___点___分到___点___分";
|
|
|
- // 处理底部人员类型勾选(可选)
|
|
|
- footerText = checkItemsInText(footerText, checkedItems);
|
|
|
setCellStyle(footerRow.getCell(0), footerText, true, ParagraphAlignment.LEFT, "FFFFFF");
|
|
|
|
|
|
- // 垂直合并第三列的单元格
|
|
|
+ // 垂直合并单元格
|
|
|
mergeCellsVertically(table, 2, 4, 2);
|
|
|
mergeCellsVertically(table, 5,7,0);
|
|
|
mergeCellsVertically(table, 5,7,1);
|
|
|
mergeCellsVertically(table, 7, 8, 2);
|
|
|
+
|
|
|
document.write(out);
|
|
|
System.out.println("生成成功:行为安全观察与沟通卡-数智化.docx");
|
|
|
|
|
|
@@ -164,44 +171,44 @@ public class SafetyObservationCardGenerator {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 核心工具方法:处理文本中的勾选框,匹配到checkedItems的子项则替换□为☑
|
|
|
- private static String checkItemsInText(String originalText, List<String> checkedItems) {
|
|
|
- if (checkedItems == null || checkedItems.isEmpty()) {
|
|
|
+ // 核心方法:根据父项+子项匹配,替换□为☑
|
|
|
+ private static String getCheckedText(String parent, String originalText, List<CheckItem> checkItems) {
|
|
|
+ if (checkItems == null || checkItems.isEmpty()) {
|
|
|
return originalText;
|
|
|
}
|
|
|
- String processedText = originalText;
|
|
|
- for (String item : checkedItems) {
|
|
|
- // 匹配 "□ 子项内容" 格式,替换为 "☑ 子项内容"
|
|
|
- String target = "□ " + item;
|
|
|
- String replacement = "☑ " + item;
|
|
|
- processedText = processedText.replace(target, replacement);
|
|
|
+ String text = originalText;
|
|
|
+ // 遍历勾选列表,匹配父项+子项
|
|
|
+ for (CheckItem item : checkItems) {
|
|
|
+ if (parent.equals(item.getParent())) {
|
|
|
+ String child = item.getChild();
|
|
|
+ // 替换对应子项的□为☑(支持换行/空格分隔)
|
|
|
+ String target = "□ " + child;
|
|
|
+ text = text.replace(target, "☑ " + child);
|
|
|
+ }
|
|
|
}
|
|
|
- return processedText;
|
|
|
+ return text;
|
|
|
}
|
|
|
|
|
|
- // 测试入口
|
|
|
+ // 测试方法
|
|
|
public static void main(String[] args) {
|
|
|
- // 示例:需要打勾的子项列表
|
|
|
- List<String> checkedItems = ImmutableList.of(
|
|
|
- "头部", // 个人防护子项
|
|
|
- "不按规定的方法操作", // 规范操作子项
|
|
|
- "指挥信号不正确/不清楚", // 规范指挥子项
|
|
|
- "碰撞到物体", // 人员位置子项
|
|
|
- "作业场所杂乱" // 作业场所子项
|
|
|
+ // 示例:勾选 个人防护-头部、规范操作-其他、人员位置-其他
|
|
|
+ List<CheckItem> checkItems = ImmutableList.of(
|
|
|
+ new CheckItem("个人防护", "头部"),
|
|
|
+ new CheckItem("规范指挥", "其他"),
|
|
|
+ new CheckItem("作业场所", "地面滑(水/雨/雪/油污等)")
|
|
|
);
|
|
|
- generateCard(checkedItems);
|
|
|
+ generateCard(checkItems);
|
|
|
}
|
|
|
|
|
|
- // 设置行高的工具方法(适配POI 5.2.5)
|
|
|
+ // ========== 以下原有方法保持不变 ==========
|
|
|
private static void setRowHeight(XWPFTableRow row, int heightInTwips) {
|
|
|
CTRow ctTr = row.getCtRow();
|
|
|
CTTrPr trPr = ctTr.getTrPr() == null ? ctTr.addNewTrPr() : ctTr.getTrPr();
|
|
|
CTHeight trHeight = trPr.addNewTrHeight();
|
|
|
trHeight.setVal(BigInteger.valueOf(heightInTwips));
|
|
|
- trHeight.setHRule(STHeightRule.EXACT); // 强制使用固定行高
|
|
|
+ trHeight.setHRule(STHeightRule.EXACT);
|
|
|
}
|
|
|
|
|
|
- // 标题样式设置
|
|
|
private static void setTitleStyle(XWPFTableCell cell, String text, boolean bold, ParagraphAlignment align, String bgColor) {
|
|
|
clearCellContent(cell);
|
|
|
|
|
|
@@ -212,25 +219,23 @@ public class SafetyObservationCardGenerator {
|
|
|
run.setFontSize(14);
|
|
|
run.setFontFamily("宋体");
|
|
|
run.setBold(bold);
|
|
|
- run.setColor("4472C4"); // 标题文字浅蓝色
|
|
|
+ run.setColor("4472C4");
|
|
|
cell.setColor(bgColor);
|
|
|
setCellBorder(cell);
|
|
|
}
|
|
|
|
|
|
- // 提示文字专属样式设置(增加左缩进+行间距)
|
|
|
private static void setTipTextStyle(XWPFTableCell cell, String text, boolean bold, ParagraphAlignment align, String bgColor) {
|
|
|
clearCellContent(cell);
|
|
|
|
|
|
- // 设置单元格垂直对齐为顶部
|
|
|
CTTcPr tcPr = cell.getCTTc().getTcPr() != null ? cell.getCTTc().getTcPr() : cell.getCTTc().addNewTcPr();
|
|
|
CTVerticalJc vAlign = tcPr.addNewVAlign();
|
|
|
vAlign.setVal(STVerticalJc.TOP);
|
|
|
|
|
|
XWPFParagraph paragraph = cell.addParagraph();
|
|
|
paragraph.setAlignment(align);
|
|
|
- paragraph.setSpacingAfter(100); // 段后间距(缇,1磅=20缇)
|
|
|
- paragraph.setSpacingBefore(100); // 段前间距
|
|
|
- paragraph.setIndentationFirstLine(288); // 左缩进2字符
|
|
|
+ paragraph.setSpacingAfter(100);
|
|
|
+ paragraph.setSpacingBefore(100);
|
|
|
+ paragraph.setIndentationFirstLine(288);
|
|
|
|
|
|
XWPFRun run = paragraph.createRun();
|
|
|
run.setText(text.trim());
|
|
|
@@ -244,25 +249,21 @@ public class SafetyObservationCardGenerator {
|
|
|
setCellBorder(cell);
|
|
|
}
|
|
|
|
|
|
- // 单元格样式设置(支持换行,增加左缩进+行间距)
|
|
|
private static void setCellStyle(XWPFTableCell cell, String text, boolean bold, ParagraphAlignment align, String bgColor) {
|
|
|
clearCellContent(cell);
|
|
|
|
|
|
- // 设置单元格垂直对齐为顶部
|
|
|
CTTcPr tcPr = cell.getCTTc().getTcPr() != null ? cell.getCTTc().getTcPr() : cell.getCTTc().addNewTcPr();
|
|
|
CTVerticalJc vAlign = tcPr.addNewVAlign();
|
|
|
vAlign.setVal(STVerticalJc.TOP);
|
|
|
|
|
|
- // 按换行符分割,每行创建一个新段落
|
|
|
String[] lines = text.split("\n");
|
|
|
for (int i = 0; i < lines.length; i++) {
|
|
|
String line = lines[i];
|
|
|
XWPFParagraph paragraph = cell.addParagraph();
|
|
|
paragraph.setAlignment(align);
|
|
|
- paragraph.setSpacingAfter(50); // 段后间距(每行之间的间距)
|
|
|
+ paragraph.setSpacingAfter(50);
|
|
|
paragraph.setSpacingBefore(0);
|
|
|
|
|
|
- // 关键:给包含□的行增加左缩进(2字符),普通行按需调整
|
|
|
if (line.startsWith("□")||line.startsWith("☑")) {
|
|
|
paragraph.setIndentationFirstLine(288);
|
|
|
} else {
|
|
|
@@ -277,7 +278,6 @@ public class SafetyObservationCardGenerator {
|
|
|
run.setTextPosition(12);
|
|
|
}
|
|
|
|
|
|
- // 处理空文本
|
|
|
if (lines.length == 0 && text.isEmpty()) {
|
|
|
XWPFParagraph paragraph = cell.addParagraph();
|
|
|
paragraph.setAlignment(align);
|
|
|
@@ -289,7 +289,6 @@ public class SafetyObservationCardGenerator {
|
|
|
setCellBorder(cell);
|
|
|
}
|
|
|
|
|
|
- // 清空单元格内容
|
|
|
private static void clearCellContent(XWPFTableCell cell) {
|
|
|
List<XWPFParagraph> paragraphs = cell.getParagraphs();
|
|
|
while (paragraphs != null && !paragraphs.isEmpty()) {
|
|
|
@@ -303,7 +302,6 @@ public class SafetyObservationCardGenerator {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 设置单元格边框
|
|
|
private static void setCellBorder(XWPFTableCell cell) {
|
|
|
CTTcPr tcPr = cell.getCTTc().getTcPr() != null ? cell.getCTTc().getTcPr() : cell.getCTTc().addNewTcPr();
|
|
|
CTTcBorders borders = tcPr.getTcBorders() != null ? tcPr.getTcBorders() : tcPr.addNewTcBorders();
|
|
|
@@ -319,7 +317,6 @@ public class SafetyObservationCardGenerator {
|
|
|
borders.getRight().setColor("000000");
|
|
|
}
|
|
|
|
|
|
- // 水平合并单元格
|
|
|
private static void mergeCellsHorizontally(XWPFTableRow row, int fromCol, int toCol) {
|
|
|
while (row.getTableCells().size() <= toCol) {
|
|
|
row.createCell();
|
|
|
@@ -334,7 +331,6 @@ public class SafetyObservationCardGenerator {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 垂直合并单元格
|
|
|
private static void mergeCellsVertically(XWPFTable table, int fromRow, int toRow, int col) {
|
|
|
for (int rowIndex = fromRow; rowIndex <= toRow; rowIndex++) {
|
|
|
XWPFTableCell cell = table.getRow(rowIndex).getCell(col);
|