去掉多余输出
This commit is contained in:
parent
1fc509abb5
commit
34bb69598d
Binary file not shown.
@ -239,13 +239,6 @@ public class OutputWordUtil {
|
||||
mergeMRWord(outFile.getPath(),repositoryId,dataMap);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Document doc = new Document(outFile.getPath());
|
||||
Section section = doc.getLastSection();
|
||||
UpFileDao upFileDao = new UpFileDao();
|
||||
@ -434,7 +427,6 @@ public class OutputWordUtil {
|
||||
Document docs1 = new Document();
|
||||
docs1.loadFromFile(outFile.getPath());
|
||||
Document docs2 = new Document();
|
||||
System.out.println("fileDCContext.getFilePath()======="+fileDCContext.getFilePath());
|
||||
docs2.loadFromFile(fileDCContext.getFilePath());
|
||||
|
||||
|
||||
@ -443,11 +435,8 @@ public class OutputWordUtil {
|
||||
// 删除最后一个节
|
||||
docs1.getSections().remove(lastSection1);
|
||||
|
||||
|
||||
System.out.println("嘻嘻嘻嘻嘻嘻休息休息=");
|
||||
// 提取所有表格
|
||||
List<Table> allTables = extractAllTables(docs2);
|
||||
System.out.println("找到11111111 " + allTables.size() + " 个表格");
|
||||
|
||||
if (allTables.size() >= 4) {
|
||||
// 拆分表格:前2个表格,后2个表格
|
||||
@ -459,15 +448,19 @@ public class OutputWordUtil {
|
||||
// 在前面插入前2个表格
|
||||
insertTablesBeforeText(docs1, firstTwoTables, position);
|
||||
|
||||
// 6. 获取docs2中剩余的内容(除了前两个表格)
|
||||
// 获取docs2中剩余的内容(除了前两个表格)
|
||||
List<DocumentObject> remainingContent = extractRemainingContent(docs2, firstTwoTables.size());
|
||||
|
||||
// 7. 将剩余内容插入到docs1的最后一节
|
||||
// 将剩余内容插入到docs1的最后一节
|
||||
insertContentToLastSection(docs1, remainingContent);
|
||||
|
||||
|
||||
// 保存合并后的文档
|
||||
docs1.saveToFile(outFile.getPath(), FileFormat.Docx);
|
||||
|
||||
docs1.dispose();
|
||||
docs2.dispose();
|
||||
|
||||
System.out.println("文档合并成功!");
|
||||
} else {
|
||||
System.out.println("未找到文本'流程图'");
|
||||
@ -476,8 +469,7 @@ public class OutputWordUtil {
|
||||
System.out.println("源文档中的表格数量不足4个,当前只有: " + allTables.size());
|
||||
}
|
||||
|
||||
docs1.dispose();
|
||||
docs2.dispose();
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3192,7 +3184,6 @@ public class OutputWordUtil {
|
||||
docs1.getSections().remove(lastSection1);
|
||||
|
||||
|
||||
|
||||
// 定位插入位置:根据text判断是“流程图前”还是“活动说明后(表格后)”
|
||||
Paragraph targetPara = null;
|
||||
Section targetSection = null;
|
||||
@ -3296,8 +3287,10 @@ public class OutputWordUtil {
|
||||
// 在目标文档末尾添加分节符,确保新节可以有不同的页面设置
|
||||
Section lastSection=docs1.addSection();
|
||||
|
||||
//设置页面方向为竖向
|
||||
lastSection.getPageSetup().setOrientation(PageOrientation.Portrait);
|
||||
|
||||
//设置页面页眉页脚不连续
|
||||
lastSection.getHeadersFooters().setLinkToPrevious(false); // 关键步骤!
|
||||
|
||||
|
||||
@ -3365,8 +3358,6 @@ public class OutputWordUtil {
|
||||
HeaderFooter targetFooter = lastSection.getHeadersFooters().getFooter();
|
||||
targetFooter.getChildObjects().clear();
|
||||
|
||||
|
||||
|
||||
HeaderFooter footer = lastSection.getHeadersFooters().getFooter();
|
||||
Paragraph fpara= footer.addParagraph();
|
||||
|
||||
@ -3399,15 +3390,6 @@ public class OutputWordUtil {
|
||||
docs1.dispose();
|
||||
docs2.dispose();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user