public static boolean list2Xls(List<?> list, String xmlPath, String filePath, String fileName) throws Exception {
        //创建目录
        File file = new File(filePath);
        if (!(file.exists())) {
            if (!file.mkdirs()) {
                throw new RuntimeException("创建导出目录失败!");
            }
        }
        try {
            ExcelConfig config = getEasyExcel(xmlPath);
            return list2Xls(config, list, filePath, fileName);
        } catch (Exception e1) {
            return false;
        }
    }
public static boolean list2Xls ( List < ? > list , String xmlPath , String filePath , String fileName ) throws Exception { File file = new File ( filePath ) ; if ( ! ( file . exists ( ) ) ) { if ( ! file . mkdirs ( ) ) { throw new RuntimeException ( "创建导出目录失败!" ) ; } } try { ExcelConfig config = getEasyExcel ( xmlPath ) ; return list2Xls ( config , list , filePath , fileName ) ; } catch ( Exception e1 ) { return false ; } }
导出list对象到excel

@param list     导出的list
@param xmlPath  xml完整路径
@param filePath 保存xls路径
@param fileName 保存xls文件名
@return 处理结果，true成功，false失败
@throws Exception