添加正文开始和结束标识。增加多行文本换行标识。

This commit is contained in:
chengli 2022-08-11 18:11:42 +08:00
parent ab54960df7
commit 3959b4a20e

View File

@ -179,7 +179,7 @@ public class WordUtilXWPF {
if (shapefirst != null && type == 0) { if (shapefirst != null && type == 0) {
isstart = false; isstart = false;
} }
if ("内容".equals(para.getParagraphText()) && numlevel == null && isstart) { if ("内容*".equals(para.getParagraphText() ) && isstart ){//&& numlevel == null && isstart) {
isstart = false; isstart = false;
continue; continue;
} }
@ -312,7 +312,7 @@ public class WordUtilXWPF {
if (paratmp.getParagraphText().matches("附件\\d{1,}")) { if (paratmp.getParagraphText().matches("附件\\d{1,}")) {
islast = true; islast = true;
} }
if ("相关文件".equals(para.getParagraphText()) && numlevel == null) { if ("正文结束*".equals(para.getParagraphText())) {
islast = true; islast = true;
isend = true; isend = true;
} }
@ -322,7 +322,7 @@ public class WordUtilXWPF {
} }
} }
if (islast) { if (islast && !isend) {
strb.append(para.getParagraphText()); strb.append(para.getParagraphText());
//拼接富文本标签 //拼接富文本标签
richSbuild.append(DocToHtml.getHtml(0, para.getParagraphText())); richSbuild.append(DocToHtml.getHtml(0, para.getParagraphText()));
@ -347,7 +347,7 @@ public class WordUtilXWPF {
//根据上一个位置计算当前位置 //根据上一个位置计算当前位置
shap = getSharp(x, y, countall, len, tmpshap, strb.toString()); shap = getSharp(x, y, countall, len, tmpshap, strb.toString());
shap.put("id", shapeId1); shap.put("id", shapeId1);
shap.put("text", getShowText(strb.toString())); shap.put("text", getShowText(strb.toString()).replaceAll("\n", ""));
//shap.put("p", pnode); //shap.put("p", pnode);
shap.put("level", 0); shap.put("level", 0);
@ -358,7 +358,7 @@ public class WordUtilXWPF {
elements.put(shapeId1, shap); elements.put(shapeId1, shap);
strb = new StringBuilder(); strb = new StringBuilder();
} else { } else {
strb.append(para.getParagraphText()); strb.append(para.getParagraphText()).append("\n");
//拼接富文本标签 //拼接富文本标签
richSbuild.append(DocToHtml.getHtml(0, para.getParagraphText())); richSbuild.append(DocToHtml.getHtml(0, para.getParagraphText()));
} }