0

有没有办法使用 jxl 获取特定工作表“Sheet_name”的索引?

jxl库的getSheet(String name)函数是做什么的?

提前致谢。

4

1 回答 1

2

Nope, there isn't.

A very simple solution would be:

final String sheetName = "somesheet";
Integer index = null;
final Sheet[] sheets = workbook.getSheets();            
for(int i=0;i<sheets.length && index == null; i++) {
    if(sheets[i].getName().equals(sheetName)) {
        index = i;                  
    }
}               
于 2013-10-10T08:12:27.797 回答