@SuppressWarnings("unchecked")
  private void writeData(Collection<T> data) {
    try {
      Set<Col> columnsToAdd = Sets.newTreeSet();
      for (T t : data) {
        if (anyColumn != null) {
          appendAnyColumns(t, columnsToAdd);
        }
      }
      addColumns(columnsToAdd, true);
      for (T t : data) {
        org.apache.poi.ss.usermodel.Row row = sheet.getNativeSheet().createRow(rowIndex);
        int i = 0;
        for (Col col : columns) {
          Set<Field> fields = ReflectionUtils.getAllFields(t.getClass(), withName(col.getFieldName()));
          Field field = fields.iterator().next();
          field.setAccessible(true);
          Object fieldValueObj = null;
          if (col.isAnyColumn()) {
            Map<String, Object> anyColumnMap = (Map<String, Object>) field.get(t);
            fieldValueObj = anyColumnMap.get(col.getName());
          } else {
            fieldValueObj = field.get(t);
          }
          Cell cell = row.createCell(i);
          writeToCell(cell, col, fieldValueObj);
          i++;
        }
        rowIndex++;
      }
    } catch (SecurityException e) {
      throw new RuntimeException(e);
    } catch (IllegalArgumentException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    }
  }