package com;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import java.io.*;
public class read {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
POIFSFileSystem fs = null;
HSSFWorkbook wb = null;
try {
fs = new POIFSFileSystem(new FileInputStream("test.xls"));
wb = new HSSFWorkbook(fs);
} catch (IOException e) {
e.printStackTrace();
}
HSSFSheet sheet = wb.getSheetAt(0);//第一张表,注意这里和数组类似是从0开始数的
HSSFRow row = sheet.getRow(4); //第4行,同样也是从0开始数的
HSSFCell cell = row.getCell((short) 3);//第3列,同样也是从0开始数的
String msg = cell.getStringCellValue();
System.out.println(msg);
}
}
- 1
- 2
前往页