org.apache.pdfbox pdfbox 1.8.13
读取WORD文件jar引用六爻 源码,怎样把vscode删干净,百度网盘 ubuntu,tomcat url配置,sqlite队列,动态网页设计图片滚动,mysql数据库索引使用,云服务器对比,wordpress 插件 ftp,md前端框架,gat爬虫,php 遍历字符串,江苏seo公司,授权框架springboot,dede 网址标签,php官方网站,易语言判断网页是否打开,小窗口模板,织梦后台怎么操作,手机wap页面弹窗,会员管理系统源代码作业,vb 取自己程序进程lzw
org.apache.poi poi-scratchpad 3.16-beta1 org.apache.poi poi 3.16-beta1
读取WORD文件方法
/** * * @Title: getTextFromWord * @Description: 读取word * @param filePath * 文件路径 * @return: String 读出的Word的内容 */ public static String getTextFromWord(String filePath) { String result = null; File file = new File(filePath); FileInputStream fis = null; try { fis = new FileInputStream(file); @SuppressWarnings("resource") WordExtractor wordExtractor = new WordExtractor(fis); result = wordExtractor.getText(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (fis != null) { try { fis.close(); } catch (IOException e) { e.printStackTrace(); } } } return result; }
读取PDF文件方法
/** * * @Title: getTextFromPdf * @Description: 读取pdf文件内容 * @param filePath * @return: 读出的pdf的内容 */public static String getTextFromPdf(String filePath) { String result = null; FileInputStream is = null; PDDocument document = null; try { is = new FileInputStream(filePath); PDFParser parser = new PDFParser(is); parser.parse(); document = parser.getPDDocument(); PDFTextStripper stripper = new PDFTextStripper(); result = stripper.getText(document); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (is != null) { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } if (document != null) { try { document.close(); } catch (IOException e) { e.printStackTrace(); } } } return result;}