我有这段代码可以从 xls 文件中读取:
fileName = "...."
WorkbookSettings settings = new WorkbookSettings();
settings.setEncoding("Cp1252");
System.out.println("BEFORE");
Workbook w = Workbook.getWorkbook(new File(fileName), settings);
Sheet sheet = w.getSheet(1);
System.out.println("AFTER");
这是我在控制台中得到的:
BEFORE
Warning: Text Object on sheet "Detalle" not supported - omitting
jxl.common.AssertionFailed
at jxl.common.Assert.verify(Assert.java:37)
at jxl.read.biff.SheetReader.handleObjectRecord(SheetReader.java:1811)
at jxl.read.biff.SheetReader.read(SheetReader.java:1059)
at jxl.read.biff.SheetImpl.readSheet(SheetImpl.java:716)
at jxl.read.biff.WorkbookParser.getSheet(WorkbookParser.java:257)
at MapMovInfoResource.postService(MapMovInfoResource.java:77)
当我尝试打开该文件中的第二张工作表时,问题就来了。当我使用第一张纸 ( w.getSheet(0)
) 时,它工作正常。
关于如何解决这个问题的任何想法?