|
|
|
@ -144,10 +144,10 @@ public class BaseUtil {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 表格处理
|
|
|
|
|
if (templatePath.equals("template/卫生自查表.docx")) { |
|
|
|
|
if ("template/卫生自查表.docx".equals(templatePath)) { |
|
|
|
|
formatHygieneRecordTable(xwpfDocument); |
|
|
|
|
} |
|
|
|
|
if (templatePath.equals("template/车辆检查表.docx")) { |
|
|
|
|
if ("template/车辆检查表.docx".equals(templatePath)) { |
|
|
|
|
formatCarCheckRecordTable(xwpfDocument); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -225,13 +225,18 @@ public class BaseUtil {
|
|
|
|
|
List<XWPFTableRow> rows = table.getRows(); |
|
|
|
|
// 第三行到倒数第二行为需合并区域
|
|
|
|
|
for (int row = 3; row < rows.size() - 1;) { |
|
|
|
|
XWPFTableCell startCell = rows.get(row).getCell(0); |
|
|
|
|
String startText = startCell.getText(); |
|
|
|
|
// 判断责任区和责任人是否完全一致,一致则合并
|
|
|
|
|
XWPFTableCell startFirstCell = rows.get(row).getCell(0); |
|
|
|
|
String startFirstText = startFirstCell.getText(); |
|
|
|
|
XWPFTableCell startSecondCell = rows.get(row).getCell(1); |
|
|
|
|
String startSecondText = startSecondCell.getText(); |
|
|
|
|
int index = row + 1; |
|
|
|
|
for (; index < rows.size(); index++) { |
|
|
|
|
XWPFTableCell endCell = rows.get(index).getCell(0); |
|
|
|
|
String endText = endCell.getText(); |
|
|
|
|
if (!startText.equals(endText)) { |
|
|
|
|
XWPFTableCell endFirstCell = rows.get(index).getCell(0); |
|
|
|
|
String endFirstText = endFirstCell.getText(); |
|
|
|
|
XWPFTableCell endSecondCell = rows.get(index).getCell(1); |
|
|
|
|
String endSecondText = endSecondCell.getText(); |
|
|
|
|
if (!startFirstText.equals(endFirstText) || !startSecondText.equals(endSecondText)) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|