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(); } }