eclipse中maven讀取Excel檔案內容,eclipsemaven
package demo;public class userinfo {private String username;private String password;private Integer jf;public userinfo(String name,String passwd,Integer j){this.username = name;this.password = passwd; this.jf = j;}public String getUsername() {return username;}public String getPassword() {return password;}public Integer getJf() {return jf;}}package demo;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import org.apache.poi.hssf.usermodel.HSSFWorkbook;import org.apache.poi.ss.usermodel.Cell;import org.apache.poi.ss.usermodel.Row;import org.apache.poi.ss.usermodel.Sheet;import org.apache.poi.ss.usermodel.Workbook;public class read_execl {public static void main(String[] args) throws Exception {File execlfile = new File("c:\\userinfo.xls");FileInputStream execlstream = new FileInputStream(execlfile);Workbook wb = new HSSFWorkbook(execlstream);//Sheet sheet = wb.getSheetAt(0);Sheet sheet = wb.getSheet("Sheet1");Row row = sheet.getRow(0);//Cell cell = row.getCell(1);System.out.println(sheet.getLastRowNum());System.out.println(row.getCell(0).getStringCellValue());}}