Amigos,
pela segunda vez venho pedir a ajuda de vcs, o problema é o seguinte: estou montando um relatorio em excel, tudo, aparentemente, funciona normalmente, ele gera os dados todos certinhos, entretanto os campo numericos estão como TEXTO, ou seja, se eu fizer um =soma(xx : xx) não me retornar a soma das celulas, como faço pra ele gerar o numero inteiro? abaixo está a parte do código
rs = stam.executeQuery(st);
WritableSheet sheet = workbook.createSheet("teste", 0);
Label label = new Label(0, 0, "teste");
sheet.addCell(label);
label = new Label(0, 1, "Período de " + diaDataIni+"/"+mesDataIni+"/"+anoDataIni+ " a " + diaDataFin+"/"+mesDataFin+"/"+anoDataFin+ "");
sheet.addCell(label);
label = new Label(0, 3, "Idade 0 a 20");
sheet.addCell(label);
label = new Label(1, 3, "Idade 21 a 25");
sheet.addCell(label);
label = new Label(2, 3, "Idade 26 a 30");
sheet.addCell(label);
label = new Label(3, 3, "Idade 31 a 35");
sheet.addCell(label);
label = new Label(4, 3, "Idade 36 a 40");
sheet.addCell(label);
label = new Label(5, 3, "Idade 41 a 45");
sheet.addCell(label);
label = new Label(6, 3, "Idade 46 a 50");
sheet.addCell(label);
label = new Label(7, 3, "Idade 51 a 55");
sheet.addCell(label);
label = new Label(8, 3, "Idade 56 a 60");
sheet.addCell(label);
label = new Label(9, 3, "Idade 61 a 70");
sheet.addCell(label);
label = new Label(10, 3, "Idade maior 71");
sheet.addCell(label);
while (rs.next()) {
String linha = String.format(rs.getString("Idade_00_a_20"));
label = new Label (0, 5,linha);
sheet.addCell(label);
linha = String.valueOf(rs.getString("Idade_21_a_25"));
label = new Label(1, 5, linha);
sheet.addCell(label);
linha = String.format(rs.getString("Idade_26_a_30"));
label = new Label(2, 5, linha);
sheet.addCell(label);
linha = String.format(rs.getString("Idade_31_a_35"));
label = new Label(3, 5, linha);
sheet.addCell(label);
linha = String.format(rs.getString("Idade_36_a_40"));
label = new Label(4, 5, linha);
sheet.addCell(label);
linha = String.format(rs.getString("Idade_41_a_45"));
label = new Label(5, 5, linha);
sheet.addCell(label);
linha = String.format(rs.getString("Idade_46_a_50"));
label = new Label(6, 5, linha);
sheet.addCell(label);
linha = String.format(rs.getString("Idade_51_a_55"));
label = new Label(7, 5, linha);
sheet.addCell(label);
linha = String.format(rs.getString("Idade_56_a_60"));
label = new Label(8, 5, linha);
sheet.addCell(label);
linha =String.format(rs.getString("Idade_61_a_70"));
label = new Label(9, 5, linha);
sheet.addCell(label);
linha = String.format(rs.getString("Idade_Acima__71"));
label = new Label(10, 5, linha);
sheet.addCell(label);
}
workbook.write();
workbook.close();
} catch (Exception e) {
System.err.println("ERRO SQL Server " + e);
}
JOptionPane.showMessageDialog(null, "Arquivo Gerado com Sucesso.");
return rs;
}
}
Eu acho que e o LABEL que aceita somente String, porém não sei o que usar para substituí-lo.
se puderem me ajudar agradeço.
Willian Baldez