文件未作为输入传递

时间:2016-01-20 12:57:49

标签: java smartxls

我将NullPointerException文件传递给方法后得到.xlsb。似乎文件未被选中,但文件存在于该文件夹中。请指教

public class readxlsb {
    public static void main(String[] args) throws Exception {
        try {
            String fileName1 ="C:\\abc\\TULDUBINV_EX_10768148_1.xlsb";
            com.smartxls.WorkBook wb = new com.smartxls.WorkBook();

            System.out.println(wb);
            wb.readXLSB(fileName1);
            System.out.println(wb);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

API的构造函数具有以下方法:

public void readXLSB(String filename) throws Exception {
    this.a.q(filename);
}

public void readXLSB(InputStream in) throws Exception {
    this.a.d(in);
}

public void readXLSB(InputStream in, String pass) throws Exception {
    this.a.a(in, pass);
}

1 个答案:

答案 0 :(得分:0)

为什么不使用jxl.Workbook,它更容易和全面。我曾与jxl合作并高度依赖它。使用类似 - Workbook workBook = Workbook.getWorkbook(new File("C:\\abc\\TULDUBINV_EX_10768148_1.xlsb")); Sheet sheet = workBook.getSheet(0);