code: public static boolean list2Xls(ExcelConfig config, List<?> list, OutputStream outputStream) throws Exception {
          try {
              String[] header = config.getHeaders();
              String[] names = config.getNames();
              String[] values;
              WritableWorkbook wb = Workbook.createWorkbook(outputStream);
              String sheetName = (config.getSheet() != null && !config.getSheet().equals("")) ? config.getSheet() : ("sheet" + config.getSheetNum());
              WritableSheet sheet = wb.createSheet(sheetName, 0);
  
              int row = 0;
              int column = 0;
              int rowadd = 0;
              //写入标题
              if (config.getHeader()) {
                  for (column = 0; column < header.length; column++) {
                      sheet.addCell(new Label(column, row + rowadd, header[column]));
                      if (config.getColumn(column).getWidth() != null) {
                          sheet.setColumnView(column, config.getColumn(column).getWidth() / 7);
                      }
                  }
                  rowadd++;
              }
              //写入内容//行
              for (row = 0; row < list.size(); row++) {
                  Object rowData = list.get(row);
                  values = getObjValues(rowData, names);
                  //列
                  for (column = 0; column < values.length; column++) {
                      sheet.addCell(new Label(column, row + rowadd, values[column]));
                  }
              }
              wb.write();
              wb.close();
          } catch (Exception e1) {
              return false;
          }
          return true;
      }
docs: 导出list对象到excel
  
  @param config   配置
  @param list     导出的list
  @param outputStream 输出流
  @return 处理结果，true成功，false失败
  @throws Exception