excel文本方式区学习笔记
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;
//文本读取
public class Demo2 {
public static void main(String[] args) throws Exception {
InputStream is = new FileInputStream(“E://data.xls”);
POIFSFileSystem fs = new POIFSFileSystem(is);
HSSFWorkbook wb = new HSSFWorkbook(fs);//创建一个新的工作簿
//文本读取
ExcelExtractor excelExtractor = new ExcelExtractor(wb);
excelExtractor.setIncludeSheetNames(false); //不需要shell标题
System.out.println(excelExtractor.getText()); //文本读取
}
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/194316.html