Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/10/2008, 18:42
DarKArtemisA
 
Fecha de Ingreso: octubre-2008
Mensajes: 15
Antigüedad: 15 años, 6 meses
Puntos: 0
Problema WritableSheet

Buenas tardes...

Tengo el problema con el siguiente codigo.

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition",
"attachment; filename=reporteSquid.xls");

WritableWorkbook w = Workbook.createWorkbook(response.getOutputStream() );

try {

for ( int j = 0; j < sIps.length; j++){
/*Aqui obtendre el query (sQuery) a ejecutar con un filtro por la variable IP*/

int iNumRen = 0;

Statement stmt = con.createStatement ();
ResultSet rs = stmt.executeQuery (sQuery);
int iNumCols = rs.getMetaData().getColumnCount ();

WritableSheet s = w.createSheet(sIps[j].toString().replace('\'', ' ').trim(), j);

while ( rs.next() ) {
for (int i=1; i<=iNumCols; i++) {
s.addCell(new Label(i, iNumRen, rs.getString(i)));
} // end for
iNumRen++;
} // end while
rs.close();
stmt.close();
}
w.write();
w.close();
} // end try



Me genera todas las hojas pero no me escribe la informacion a partir de la hoja 6 o escribe basura, si yo le hago un debug la informacion si es la correcta, no lleva basura, el problema es al escribir en el excel...

Si alguien sabe que es lo que sucede, le agradeceria su ayuda.