我試圖用jxl讀取excel文件。這是給StringIndexOutOfBoundsException
。我不知道爲什麼我得到這個代碼。Excel讀取給出java.lang.StringIndexOutOfBoundsException
public class TestExcelReader {
public static void main(String args[]) throws BiffException, IOException{
File file=new File("D:\\TestExcel.xls");
Workbook workbook=Workbook.getWorkbook(file); \\Line number 14
Sheet sheet=workbook.getSheet(0);
System.out.println("No of rows is "+sheet.getRows());
}
}
我的例外:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 68
at java.lang.String.checkBounds(Unknown Source)
at java.lang.String.<init>(Unknown Source)
at jxl.biff.StringHelper.getString(StringHelper.java:164)
at jxl.read.biff.WriteAccessRecord.<init>(WriteAccessRecord.java:56)
at jxl.read.biff.WorkbookParser.parse(WorkbookParser.java:821)
at jxl.Workbook.getWorkbook(Workbook.java:237)
at jxl.Workbook.getWorkbook(Workbook.java:198)
at ext.gt.test.TestExcelReader.main(TestExcelReader.java:14)
是'Workbook'你的嗎? – GGrec
我不明白...?我正在使用'jxl.Workbook'類 –
哪一行是TestExcelReader中的第14行? –