处理标题中的特殊字符
This commit is contained in:
parent
dbbd375ed8
commit
7e108247cf
Binary file not shown.
@ -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;
|
||||
|
||||
@ -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<String, List<String>> verticalTableText = this.getVerticalTableText(table);
|
||||
List<String> 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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user