【发布时间】:2011-03-24 04:22:26
【问题描述】:
当我在我的 eclipse 项目中添加 jxl.jar 时,它在控制台中看到了 dalvik 格式的转换错误。
控制台显示错误:
[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();
}
}
}
有没有办法解决这个问题?
谢谢 明图
【问题讨论】:
-
最好发布您收到的错误消息
-
控制台中显示错误:[2010-08-02 19:11:22 - TestApp] 写入输出时遇到问题:不应该发生 [2010-08-02 19:11:22 - TestApp] 转换到 Dalvik 格式失败,错误 2
标签: android