【web开发】☆★之利用POI操作Excel表格系列教程【7】Excel文本取值
package com.xiaoye.demo; import java.io.FileInputStream; import java.io.InputStream; import org.apache.poi.hssf.extractor.ExcelExtractor; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; /** * 遍历excel文本 * @author 小夜的传说 * 2014-2-22 下午4:26:55 */ public class ThrText { public static void main(String[] args) throws Exception { InputStream in=new FileInputStream("d://测试文件.xls"); POIFSFileSystem fs=new POIFSFileSystem(in); HSSFWorkbook wb=new HSSFWorkbook(fs); ExcelExtractor excelExtractor=new ExcelExtractor(wb); excelExtractor.setIncludeSheetNames(false);//这个意思是不需要Sheet页的名字 System.out.println(excelExtractor.getText()); } }
效果图: