解析文件
doc、docx解析方法
public static String parseFile(File docFile) {
String fileName = docFile.getName();
String docContent = null;
FileInputStream fis = null;
try {
fis = new FileInputStream(docFile);
if (fileName.toLowerCase().endsWith(doc)) {
HWPFDocument doc = new HWPFDocument(fis);
docContent = doc.getDocumentText();
} else if (fileName.toLowerCase().endsWith(docx)) {

这篇博客介绍了如何使用Java解析doc和docx文档,通过HWPFDocument和XWPFDocument类处理不同格式。同时,也展示了利用PDDocument和PDFTextStripper解析pdf文件的内容。
最低0.47元/天 解锁文章

7517

被折叠的 条评论
为什么被折叠?



