Created
July 17, 2014 07:24
-
-
Save john-evangelist/5759eb4998296ce0674c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void makeReport(){ | |
try{ | |
JasperReport jasperReport = JasperManager.compileReport("pathToJRXML"); | |
Map params = new HashMap(); | |
params.put("key",123); | |
/**constroi o report | |
*@param jasperReport o jrxml carregado | |
*@param params | |
*@dataSource conexação com o banco | |
**/ | |
JasperPrint jasperPrint = JasperManager.fillReport(jasperReport, params, dataSource); | |
//exporta o report para um arquivo pdf no disco | |
JasperManager.printReportToPdfFile(jasperPrint, "pathToExport"); | |
//OU | |
//exibe a view do report | |
JasperView.viewReport(jasperPrint); | |
}catch(JRException e){ | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment