Olá…
Estou tentando realizar montar um recibo, mas tá complicado =p
public void montaRelatorio(Recibo recibo){
try{
HashMap<String, String> atributosRecibo = new HashMap<String, String>();
atributosRecibo.put("valor", recibo.getValor());
atributosRecibo.put("valorEscrito", recibo.getValorEscrito());
atributosRecibo.put("cliente", recibo.getCliente());
atributosRecibo.put("nomeFantasia", recibo.getNomeFantasia());
atributosRecibo.put("cliente", recibo.getCliente());
atributosRecibo.put("endereco", recibo.getEndereco());
atributosRecibo.put("telefone", recibo.getTelefone());
atributosRecibo.put("email", recibo.getEmail());
atributosRecibo.put("data", recibo.getData());
ArrayList<Recibo> recibos = new ArrayList<Recibo>();
recibos.add(recibo);
JRMapCollectionDataSource collection = new JRMapCollectionDataSource(recibos);
JasperPrint relatorio = JasperFillManager.fillReport("C:\ReciboVidracaria.jasper", new HashMap(), collection);
JasperExportManager.exportReportToPdfFile(relatorio, "C:\ReciboTeste.pdf");
java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
desktop.open(new File("C:\ReciboTeste.pdf"));
}catch (Exception e) {
e.printStackTrace();
}
}
Erro:
java.lang.ClassCastException: projetovidracaria.model.Recibo cannot be cast to java.util.Map
Se alguém poder me ajudar, desde já agradeço!