Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/09/2011, 22:24
iran394
 
Fecha de Ingreso: enero-2011
Ubicación: Cuba
Mensajes: 124
Antigüedad: 13 años, 3 meses
Puntos: 1
Respuesta: mostrar un reporte

Hola socio yo probé este código y me sale bien echale un vistaso......

public void ReporteProductos()throws Exception {



try {
JasperReport masterReport = (JasperReport) JRLoader.loadObject("src/Reprt_productos/Productos.jasper");//SE CARGA EL REPORTE DE DONDE ESTA
// Map parametro = new HashMap(); no se pasa ningun parametro
JasperPrint jasperPrint = JasperFillManager.fillReport(masterReport, null, conn);// se pone null porque no le paso parametros al reporte para buscarlo
JasperViewer jviewer = new JasperViewer(jasperPrint, false);// vista del reprote

JasperPrintManager.printReport(jasperPrint, true);



jviewer.setTitle("REPORTE DE PRODUCTOS");
jviewer.setVisible(true);


JRExporter exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_P RINT,jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_F ILE,new java.io.File("Productos.pdf"));
exporter.exportReport();


}catch (Exception j) {
System.out.println("mensaje de error:" + j.getMessage());
}
}



acá está mi correo: [email protected]