public class WordUtil extends Object
| 构造器和说明 |
|---|
WordUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
changeParagraphText(org.apache.poi.xwpf.usermodel.XWPFDocument document,
Map<String,String> textMap)
替换段落文本
|
static void |
changeTable(org.apache.poi.xwpf.usermodel.XWPFDocument document,
Map<String,String> textMap,
List<String[]> tableList)
替换表格对象方法
|
static void |
changeTableText(org.apache.poi.xwpf.usermodel.XWPFDocument document,
Map<String,String> textMap)
替换表格文本
|
static String |
changeValue(String value,
Map<String,String> textMap)
匹配传入信息集合与模板
|
static org.apache.poi.xwpf.usermodel.XWPFDocument |
changWord(String inputUrl,
Map<String,String> textMap)
已过时。
|
static org.apache.poi.xwpf.usermodel.XWPFDocument |
changWord(String inputUrl,
Map<String,String> textMap,
List<String[]> tableList)
已过时。
|
static boolean |
changWord(String inputUrl,
String outputUrl,
Map<String,String> textMap,
List<String[]> tableList)
已过时。
|
static boolean |
checkText(String text)
判断文本中时候包含$
|
static void |
eachTable(List<org.apache.poi.xwpf.usermodel.XWPFTableRow> rows,
Map<String,String> textMap)
遍历表格
|
static void |
insertTable(org.apache.poi.xwpf.usermodel.XWPFTable table,
List<String[]> tableList)
为表格插入数据,行数不够添加新行
|
static boolean |
isWord2003(String filePath) |
static boolean |
isWord2007(String filePath) |
static void |
main(String[] args) |
static org.apache.poi.xwpf.usermodel.XWPFDocument |
replaceWord(String inputUrl,
Map<String,String> textMap) |
static boolean |
replaceWord(String inputUrl,
String outputUrl,
Map<String,String> textMap)
根据模板生成新word文档
|
static boolean |
validateWord(String filePath)
验证是否是 word 文件
|
public static boolean isWord2003(String filePath)
filePath - public static boolean isWord2007(String filePath)
filePath - public static boolean validateWord(String filePath)
filePath - public static boolean replaceWord(String inputUrl, String outputUrl, Map<String,String> textMap)
inputUrl - 模板存放地址outputUrl - 新文档存放地址textMap - 需要替换的信息集合public static org.apache.poi.xwpf.usermodel.XWPFDocument replaceWord(String inputUrl, Map<String,String> textMap)
public static void changeParagraphText(org.apache.poi.xwpf.usermodel.XWPFDocument document,
Map<String,String> textMap)
document - docx 解析对象textMap - 需要替换的信息集合public static void changeTableText(org.apache.poi.xwpf.usermodel.XWPFDocument document,
Map<String,String> textMap)
document - docx 解析对象textMap - 需要替换的信息集合public static void changeTable(org.apache.poi.xwpf.usermodel.XWPFDocument document,
Map<String,String> textMap,
List<String[]> tableList)
document - docx解析对象textMap - 需要替换的信息集合tableList - 需要插入的表格信息集合public static void eachTable(List<org.apache.poi.xwpf.usermodel.XWPFTableRow> rows, Map<String,String> textMap)
rows - 表格行对象textMap - 需要替换的信息集合public static void insertTable(org.apache.poi.xwpf.usermodel.XWPFTable table,
List<String[]> tableList)
table - 需要插入数据的表格tableList - 插入数据集合public static boolean checkText(String text)
text - 文本public static String changeValue(String value, Map<String,String> textMap)
value - 模板需要替换的区域textMap - 传入信息集合@Deprecated public static boolean changWord(String inputUrl, String outputUrl, Map<String,String> textMap, List<String[]> tableList)
inputUrl - 模板存放地址outPutUrl - 新文档存放地址textMap - 需要替换的信息集合tableList - 需要插入的表格信息集合@Deprecated public static org.apache.poi.xwpf.usermodel.XWPFDocument changWord(String inputUrl, Map<String,String> textMap, List<String[]> tableList)
@Deprecated public static org.apache.poi.xwpf.usermodel.XWPFDocument changWord(String inputUrl, Map<String,String> textMap)
public static void main(String[] args)
Copyright © 2022. All rights reserved.