code: private void generateSheet(Workbook workbook, List<?> data, List<String> header, String sheetName) {
  
          Sheet sheet;
          if (null != sheetName && !"".equals(sheetName)) {
              sheet = workbook.createSheet(sheetName);
          } else {
              sheet = workbook.createSheet();
          }
  
          int rowIndex = 0;
          if (null != header && header.size() > 0) {
              // 写标题
              Row row = sheet.createRow(rowIndex++);
              for (int i = 0; i < header.size(); i++) {
                  row.createCell(i, CellType.STRING).setCellValue(header.get(i));
              }
          }
          for (Object object : data) {
              Row row = sheet.createRow(rowIndex++);
              if (object.getClass().isArray()) {
                  for (int j = 0; j < Array.getLength(object); j++) {
                      row.createCell(j, CellType.STRING).setCellValue(Array.get(object, j).toString());
                  }
              } else if (object instanceof Collection) {
                  Collection<?> items = (Collection<?>) object;
                  int j = 0;
                  for (Object item : items) {
                      row.createCell(j++, CellType.STRING).setCellValue(item.toString());
                  }
              } else {
                  row.createCell(0, CellType.STRING).setCellValue(object.toString());
              }
          }
      }
docs: 生成sheet数据内容