Apache POI是Apache软件基金会的开放源码函式库,POI提供API给Java程序对Microsoft Office格式档案读和写的功能。 HSSF - 提供读写Microsoft Excel格式档案的功能。 XSSF - 提供读写Microsoft OO ...
Apache POI是Apache软件基金会的开放源码函式库,POI提供API给Java程序对Microsoft Office格式档案读和写的功能。
HSSF - 提供读写Microsoft Excel格式档案的功能。
使用POI解析EXCEL文件需要用到POI相关的jar包,这些jar包可以在apache官网上去下载:http://poi.apache.org/download.html;
这里我使用的jar包版本为poi-3.14-beta1-20151223.jar
相关代码如下:
Excel文件解析接口 IExcelParse.java
1 /* 2 * IExcelParse.java 3 * 4 * 2016-1-6 下午4:45:53 5 * 6 * RecluseKapoor 7 * 8 * Copyright © 2016, RecluseKapoor. All rights reserved. 9 * 10 */11 package com.rk.pub.poi.excel;12 13 /**14 * @Title: recluse-Excel文件解析接口15 * 16 * @Description:Excel文件解析接口,所有版本的Excel解析类都要实现该接口17 * 18 * @Company: 卡普工作室19 * 20 * @Website: http://www.cnblogs.com/reclusekapoor/21 * 22 * @author: RecluseKapoor23 * 24 * @CreateDate:2016-1-6 下午9:42:0825 * 26 * @version: 1.027 * 28 * @lastModify:29 * 30 */31 public interface IExcelParse {32 public void loadExcel(String path) throws Exception;33 34 public String getSheetName(int sheetNo);35 36 public int getSheetCount() throws Exception;37 38 public int getRowCount(int sheetNo);39 40 public int getRealRowCount(int sheetNo);41 42 public String readExcelByRowAndCell(int sheetNo, int rowNo, int cellNo)43 throws Exception;44 45 public String[] readExcelByRow(int sheetNo, int rowNo) throws Exception;46 47 public String[] readExcelByCell(int sheetNo, int cellNo) throws Exception;48 49 public void close();50 }
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:POI 读取Excel文档中的数据——兼容Excel2003和Excel2007
关键词:excel
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。