diff --git a/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar b/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar index b781c7e0..c6295d43 100644 Binary files a/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar and b/com.actionsoft.apps.coe.pal.datamigration/lib/com.actionsoft.apps.coe.pal.datamigration.jar differ diff --git a/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/util/readtable/ReadTable.java b/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/util/readtable/ReadTable.java index ec82fdf4..0b366cf0 100644 --- a/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/util/readtable/ReadTable.java +++ b/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/util/readtable/ReadTable.java @@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.aspose.words.Document; import com.aspose.words.SaveFormat; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.usermodel.*; @@ -32,6 +33,7 @@ import java.util.*; * @Description: * @date 2022/6/30 21:47 */ +@Slf4j public class ReadTable { //相关文件、存文件名称 private String version = ""; @@ -253,10 +255,11 @@ public class ReadTable { if (fieldMap.get("标题") != null) { title = fieldMap.get("标题").toString(); } - title = title + nowPara.text().replace("\r", ""); + title = title + nowPara.text().replace("\r", "").replace("\b", "").replace("\t", "").replace("\f", ""); fieldMap.put("标题", title); fileFieldMap.put("标题", new WordField<>(title)); titleover = 1; + log.info("识别的标题为:" + title); continue; } } @@ -559,7 +562,12 @@ public class ReadTable { fontName = characterRun.getFontName(); if (fontName.contains("黑体")) { //与文档fontsize标号2倍关系 ,黑体一号 等于 26号size - return (characterRun.isBold() && characterRun.getFontSize() == 52) || characterRun.getFontSize() == 44; + if (characterRun.isBold() && characterRun.getFontSize() == 52) { + return true; + } + if (characterRun.getFontSize() == 44) { + return true; + } } } return false; diff --git a/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/util/readword/ReadWordUtil.java b/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/util/readword/ReadWordUtil.java index 07e1c433..7698e171 100644 --- a/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/util/readword/ReadWordUtil.java +++ b/com.actionsoft.apps.coe.pal.datamigration/src/com/actionsoft/apps/coe/pal/datamigration/util/readword/ReadWordUtil.java @@ -119,7 +119,7 @@ public class ReadWordUtil { }); jsonObject.put("table", jsonArray); new CoeProcessLevelWeb(userContext).moreAttrContentSave(id, "term", jsonObject.toJSONString()); - }else if ("组织/角色与职责".equals(key)) { + } else if ("组织/角色与职责".equals(key)) { List nowdata = (List) tmp.getData(); JSONObject jsonObject = new JSONObject(); jsonObject.put("name", "组织角色"); @@ -221,7 +221,7 @@ public class ReadWordUtil { return; } //创建图形 - if(iscreatemap){ + if (iscreatemap) { DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, docxname); InputStream docxfile = SDK.getDCAPI().read(dcContextpdf1); new CreateMaps().updateMaps(userContext, wsId, docxfile, title); @@ -254,7 +254,7 @@ public class ReadWordUtil { if (fieldMap.get("标题") != null) { title = fieldMap.get("标题").toString(); } - title = title + nowPara.text().replace("\r", "").replace("\b", "").replace("\t", ""); + title = title + nowPara.text().replace("\r", "").replace("\b", "").replace("\t", "").replace("\f", ""); fieldMap.put("标题", title); fileFieldMap.put("标题", new WordField<>(title)); titleover = 1; @@ -382,13 +382,13 @@ public class ReadWordUtil { Table table = range.getTable(paragraph); Map> verticalTableText = this.getVerticalTableText(table); List strings = null; - if(verticalTableText.get("文件") != null){ + if (verticalTableText.get("文件") != null) { strings = verticalTableText.get("文件"); } - if(verticalTableText.get("文件名称") != null){ + if (verticalTableText.get("文件名称") != null) { strings = verticalTableText.get("文件名称"); } - if(strings != null){ + if (strings != null) { fileMap.put(wordAttribute.getTitle(), strings); fileFieldMap.put(wordAttribute.getTitle(), new WordField<>(strings)); } @@ -447,6 +447,7 @@ public class ReadWordUtil { /** * 将所有的属性解析出来 + * * @param tb * @return */ @@ -473,9 +474,9 @@ public class ReadWordUtil { } sb.append(s); } - key = sb.toString().replaceAll(" ",""); + key = sb.toString().replaceAll(" ", ""); //看看是否是键值 - if(nameToIdMap.containsKey(key) && result.get(key) == null && j < (tr.numCells()-1)){ + if (nameToIdMap.containsKey(key) && result.get(key) == null && j < (tr.numCells() - 1)) { //取得单元格 j += 1; TableCell tdtmp = tr.getCell(j);