3
當我在eclipse項目中添加jxl.jar時,它看到了轉換錯誤爲dalvik格式到控制檯。在控制檯如何使用JXL 2.6.12讀取excel文件jar
錯誤顯示:
[2010-08-02 19點11分22秒 - TestApp]麻煩寫輸出:不應該發生
[2010-08-02 19點11分22秒 - TestApp]轉換爲Dalvik的格式失敗,出現錯誤2
代碼是確定
下面是我的代碼:
import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.CellType;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class ReadExcel {
private String inputFile;
public void setInputFile(String inputFile) {
this.inputFile = inputFile;
}
public void read() throws IOException {
File inputWorkbook = new File(inputFile);
Workbook w;
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet
Sheet sheet = w.getSheet(0);
// Loop over first 10 column and lines
for (int j = 0; j < sheet.getColumns(); j++) {
for (int i = 0; i < sheet.getRows(); i++) {
Cell cell = sheet.getCell(j, i);
CellType type = cell.getType();
if (cell.getType() == CellType.LABEL) {
System.out.println("I got a label "
+ cell.getContents());
}
if (cell.getType() == CellType.NUMBER) {
System.out.println("I got a number "
+ cell.getContents());
}
}
}
} catch (BiffException e) {
e.printStackTrace();
}
}
}
有沒有辦法解決這個問題?
感謝 Mintu
將很好發佈您收到的錯誤消息 – 2010-08-02 12:14:56
錯誤顯示在控制檯中:[2010-08-02 19:11:22 - TestApp]麻煩寫輸出:應該不會發生[2010-08-02 19 :11:22 - TestApp]轉換爲Dalvik格式失敗,出現錯誤2 – 2010-08-02 13:43:24