处理标题中的特殊字符
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; | ||||
|  | ||||
| @ -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; | ||||
| @ -447,6 +447,7 @@ public class ReadWordUtil { | ||||
| 
 | ||||
|     /** | ||||
|      * 将所有的属性解析出来 | ||||
|      * | ||||
|      * @param tb | ||||
|      * @return | ||||
|      */ | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 chengli
						chengli