
用javaPOI包的方法获取excel中的行列号
现在需要用java的POI包的方法获取到excel某一个单元格的坐标,也就是他的行号和列号,比如:ABCD1afvs2sedm我现在确定了f的位置,用什么方法可以得到他的...
现在需要用java的POI包的方法获取到excel某一个单元格的坐标,也就是他的行号 和 列号 ,比如:
A B C D
1 a f v s
2 s e d m
我现在确定了 f的位置,用什么方法可以得到他的列号,也就是如何得到“B”。poi里面提供这种方法了吗? 展开
A B C D
1 a f v s
2 s e d m
我现在确定了 f的位置,用什么方法可以得到他的列号,也就是如何得到“B”。poi里面提供这种方法了吗? 展开
2个回答
2013-07-10
展开全部
不会啊.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-07-10
展开全部
HSSFWorkbook wb;
HSSFSheet sheet;
HSSFRow row;
HSSFCell cell;// 获得Excel文件
public void openExl() {
Frame f = new Frame("test for filedialog");
FileDialog file = new FileDialog(f, "new");
file.setVisible(true);
path = file.getDirectory() + file.getFile();
path = path.replace("\\", "/");
System.out.println(path);
} // 获得Excel文件
public void openExl(String name) {
path = name;
System.out.println(path);
} public void getExl() {
try {
myxls = new FileInputStream(path);
wb = new HSSFWorkbook(myxls);
sheet = wb.getSheetAt(0); // 工作表
row = sheet.getRow(0); // 行
cell = row.getCell((short) 0); // 单元格
sheet_n = wb.getNumberOfSheets();
row_n = sheet.getLastRowNum();
System.out.println(sheet_n + "," + row_n);
}
catch (Exception e) {
e.printStackTrace();
}
}
HSSFSheet sheet;
HSSFRow row;
HSSFCell cell;// 获得Excel文件
public void openExl() {
Frame f = new Frame("test for filedialog");
FileDialog file = new FileDialog(f, "new");
file.setVisible(true);
path = file.getDirectory() + file.getFile();
path = path.replace("\\", "/");
System.out.println(path);
} // 获得Excel文件
public void openExl(String name) {
path = name;
System.out.println(path);
} public void getExl() {
try {
myxls = new FileInputStream(path);
wb = new HSSFWorkbook(myxls);
sheet = wb.getSheetAt(0); // 工作表
row = sheet.getRow(0); // 行
cell = row.getCell((short) 0); // 单元格
sheet_n = wb.getNumberOfSheets();
row_n = sheet.getLastRowNum();
System.out.println(sheet_n + "," + row_n);
}
catch (Exception e) {
e.printStackTrace();
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询