Exception when using jxl library
807605Oct 12 2006 — edited Jun 27 2007hii all,
am trying to read data from an excel sheet using java code.
this is my class i have written:
import java.io.File;
import java.io.*;
import jxl.*;
import java.util.*;
import jxl.Workbook;
import jxl.read.biff.*;
class readXls
{
public static void main(String[] args)
{
try
{
String filename = "input.ods";
WorkbookSettings ws = new WorkbookSettings();
ws.setLocale(new Locale("en", "EN"));
Workbook workbook = Workbook.getWorkbook(new File(filename),ws);
Sheet s = workbook.getSheet(0);
readDataSheet(s);
workbook.close();
}
catch (IOException e)
{
e.printStackTrace();
}
catch (BiffException e)
{
e.printStackTrace();
}
}
private static void readDataSheet(Sheet s)
{
Cell lc = s.getCell(1, 1);
System.out.println("****************" + lc.getContents()+"****************");
}
}
when running this program i got the following exception:
jxl.read.biff.BiffException: Unable to recognize OLE stream
at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:111)
at jxl.read.biff.File.<init>(File.java:127)
at jxl.Workbook.getWorkbook(Workbook.java:210)
at readXls.main(test.java:18)
please help.
Regards