InputStream inp = new FileInputStream("E:\\standarcode\\workbook.xls");
HSSFWorkbook wb = new HSSFWorkbook(new POIFSFileSystem(inp));
ExcelExtractor extractor = new ExcelExtractor(wb);
extractor.setFormulasNotResults(true);
extractor.setIncludeSheetNames(false);
String text = extractor.getText();
System.out.println(text);
原文件:
输出文本:
本文介绍了一种使用Java编程语言从Excel(.xls)文件中提取文本的方法。具体步骤包括通过FileInputStream打开文件,利用HSSFWorkbook读取Excel工作簿,创建ExcelExtractor对象并设置相关参数以获取纯文本内容。
1282

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



