1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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();
| }
| }
|
|