public static voidtest2(String path){
File file= newFile(path);
Workbook workbook;try{
workbook=Workbook.getWorkbook(file);
Sheet sheet= workbook.getSheet(0);//获取第一个sheet
Cell[] cell = sheet.getColumn(4);//获取第一列中的值
int len = cell.length;//共有多少行
Map map = newHashMap();for(int i = 0;i
Cell cell1=cell[i];
System.out.println("第"+(i+Integer.parseInt("1"))+"行\t"+cell1.getContents()+"\t"+"'"+cell1.getContents()+"',");
map.put(i,cell1.getContents());//System.out.println("select * from axa_user where id="+"'"+cell1.getContents()+"',");
}
System.out.println("总共有"+len+"行");
System.out.println(map.toString());/*Sheet sheet1 = workbook.getSheet(1);//读取第二个sheet中的内容
Cell[] cell1 = sheet1.getColumn(0);//获取第一列中内容
Cell[] cell2 = sheet1.getColumn(1);//获取第二列中内容
Map map1 = new HashMap();
for(int len1=0;len1
Cell c1 = cell1[len1];
map1.put(len1,c1.getContents());
}
Map map2 = new HashMap();
for(int len2=0;len2
Cell c2 = cell2[len2];
map2.put(len2,c2.getContents());
}
Map map3 = new HashMap();
for(Map.Entry entry2:map2.entrySet()){
for(Map.Entry entry1:map1.entrySet()){
if(entry2.getValue().equals(entry1.getValue())){
map3.put(entry1.getKey(),entry1.getValue());
}
}
}
System.out.println(cell1.length);
System.out.println(cell2.length);
System.out.println("map1\t"+map1.toString());
System.out.println("map2\t"+map2.toString());
System.out.println("map3\t"+map3.toString());*/}catch(IOException e) {
e.printStackTrace();
}catch(BiffException e) {
e.printStackTrace();
}
}