跳转至

Aspose Cells

使用

//类加载器
public static ClassLoader getDefaultClassLoader() {
    ClassLoader classLoader = null;
    try {
        classLoader = Thread.currentThread().getContextClassLoader();//当前线程的类加载器
        return classLoader;
    } catch(Throwable ex) {}
    classLoader = ExportUtils.class.getClassLoader();//当前类的类加载器
    if (null == classLoader) {
       try {
           classLoader = ClassLoader.getSystemClassLoader();//系统初始的类加载器   
       } catch(Throwable ex) {
           ex.printStackTrace();
           throw new RuntimeException("类加载器加载失败")
       }
    }
    return classLoader;
}

ExportUtils.setlicense();
public static void setLicence() {
    ClassLoader classLoader = getDefaultClassLoader();
    InputStream inputStream = classLoader.getResourceAsStream("license.lic");
    if (null == inputStream) { throw new RuntimeExceotion("")}
    License asposeLicense = new License();
    asposeLicense.setLicense(inputStream);
}
File excelFile = ExportUtils.getFilePath("xxx.xlsx");
public static File getFilePath(String fileName) {
}