Skip to content

Instantly share code, notes, and snippets.

@HashRaygoza
Created May 9, 2020 19:30
Show Gist options
  • Select an option

  • Save HashRaygoza/f92375fc286af0a3eb22ee661572f89b to your computer and use it in GitHub Desktop.

Select an option

Save HashRaygoza/f92375fc286af0a3eb22ee661572f89b to your computer and use it in GitHub Desktop.
Agrega datos a una fila de Excel
protected <TipoGenerico> void agregarDatos(Row fila, TipoGenerico dato) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
Class clase = dato.getClass();
Field[] campos = clase.getDeclaredFields();
int numCelda = 0;
for (Field campo : campos) {
ColumnaReporte columna = campo.getAnnotation(ColumnaReporte.class);
Cell celda = fila.createCell(numCelda);
if (columna != null) {
this.agregarDato(celda, PropertyUtils.getSimpleProperty(dato, campo.getName()));
numCelda++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment