列表数据转换excel格式(二维数组)
/** * 用户访问排行列表转换为excel导出二维数组 * @param statisticsList * @return */ public static String[][] userListToExportArray(List<Statistics> statisticsList) { String[] title = new String[]{"用户名", "访问总量", "访问入口", "检索", "浏览", "下载"}; String[][] abc = new String[statisticsList.size() + 1][title.length]; abc[0] = title; if(statisticsList != null && statisticsList.size() > 0) { for (int i = 0; i < statisticsList.size(); i++) { Statistics s = statisticsList.get(i); abc[i + 1] = new String[] { s.getUserName(), s.getTotal().toString(), s.getEntrance().toString(), s.getSearch().toString(), s.getBrowse().toString(), s.getDownload().toString()}; } } return abc;