From c800257cb6c8b45e7edc20e2e9018cd90b230806 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期三, 09 七月 2025 19:50:00 +0800 Subject: [PATCH] art: 技术状态鉴定-基础代码生成 --- lxzn-boot-base-core/src/main/java/org/jeecg/common/util/WordParseUtils.java | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/lxzn-boot-base-core/src/main/java/org/jeecg/common/util/WordParseUtils.java b/lxzn-boot-base-core/src/main/java/org/jeecg/common/util/WordParseUtils.java new file mode 100644 index 0000000..9bf9d00 --- /dev/null +++ b/lxzn-boot-base-core/src/main/java/org/jeecg/common/util/WordParseUtils.java @@ -0,0 +1,42 @@ +package org.jeecg.common.util; + +import org.apache.poi.xwpf.usermodel.XWPFParagraph; +import org.apache.poi.xwpf.usermodel.XWPFRun; +import org.apache.poi.xwpf.usermodel.XWPFTableCell; + +public class WordParseUtils { + /** + * 鍏煎鐗堝崟鍏冩牸鏂囨湰鎻愬彇 + */ + public static String getCellText(XWPFTableCell cell) { + if (cell == null) { + return ""; + } + String text = cell.getText(); + + return text.toString(); + } + + /** + * 鍐呭娓呯悊 + */ + private String cleanContent(String text) { + if (text == null) { + return ""; + } + // 鏇挎崲鐗规畩绌烘牸鍜屽悎骞惰繛缁┖鏍� + text = text.replace('\u00A0', ' ') + .replace('\u2007', ' ') + .replace('\u202F', ' ') + .replaceAll("\\s+", " "); + + // 瑙勮寖鏍囩偣绗﹀彿 + return text.replace(',', '銆�') + .replace('锛�', '銆�') + .replace(';', '锛�') + .replace('锛�', '锛�') + .replace(':', '锛�') + .replace('锛�', '锛�') + .trim(); + } +} -- Gitblit v1.9.3