aissaoui.moetaz Posted March 31, 2022 Share Posted March 31, 2022 Hey community , im actually doing my end of year project in jasper soft studio , the data that the company provided me is the following is it poossible to work with this data ?thank you Link to comment Share on other sites More sharing options...
maci.sajko Posted April 3, 2022 Share Posted April 3, 2022 @RequestMapping(value="/getSviClanoviReport.pdf", method=RequestMethod.GET) public void showReport(HttpServletResponse response) throws Exception{ JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(cr.findAllByOrderByDatumUpisa()); InputStream inputStream = this.getClass().getResourceAsStream("/jasperreports/SviClanoviReport.jrxml"); JasperReport jasperReport = JasperCompileManager.compileReport(inputStream); Map<String, Object> params = new HashMap<String, Object>(); params.put("imeBiblioteke", "Biblioteka DMI"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource); inputStream.close(); response.setContentType("application/x-download"); response.addHeader("Content-disposition", "attachment; filename=SviClanovi.pdf"); OutputStream out = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint,out); } Another One @RequestMapping(value="/ClanoviUPeriodu.pdf", method=RequestMethod.GET) public void showReport1(HttpServletResponse response, Date datumOd, Date datumDo) throws Exception{ JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(cr.getClanoviUPeriodu(datumOd, datumDo)); InputStream inputStream = this.getClass().getResourceAsStream("/jasperreports/ClanoviUPeriodu.jrxml"); JasperReport jasperReport = JasperCompileManager.compileReport(inputStream); Map<String, Object> params = new HashMap<String, Object>(); params.put("datumOd", datumOd); params.put("datumDo", datumDo); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource); inputStream.close(); response.setContentType("application/x-download"); response.addHeader("Content-disposition", "attachment; filename=ClanoviUPeriodu.pdf"); OutputStream out = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint,out); } Link to comment Share on other sites More sharing options...
maci.sajko Posted April 3, 2022 Share Posted April 3, 2022 @RequestMapping(value="/getSviClanoviReport.pdf", method=RequestMethod.GET) public void showReport(HttpServletResponse response) throws Exception{ JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(cr.findAllByOrderByDatumUpisa()); InputStream inputStream = this.getClass().getResourceAsStream("/jasperreports/SviClanoviReport.jrxml"); JasperReport jasperReport = JasperCompileManager.compileReport(inputStream); Map<String, Object> params = new HashMap<String, Object>(); params.put("imeBiblioteke", "Biblioteka DMI"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource); inputStream.close(); response.setContentType("application/x-download"); response.addHeader("Content-disposition", "attachment; filename=SviClanovi.pdf"); OutputStream out = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint,out); }Another One @RequestMapping(value="/ClanoviUPeriodu.pdf", method=RequestMethod.GET) public void showReport1(HttpServletResponse response, Date datumOd, Date datumDo) throws Exception{ JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(cr.getClanoviUPeriodu(datumOd, datumDo)); InputStream inputStream = this.getClass().getResourceAsStream("/jasperreports/ClanoviUPeriodu.jrxml"); JasperReport jasperReport = JasperCompileManager.compileReport(inputStream); Map<String, Object> params = new HashMap<String, Object>(); params.put("datumOd", datumOd); params.put("datumDo", datumDo); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource); inputStream.close(); response.setContentType("application/x-download"); response.addHeader("Content-disposition", "attachment; filename=ClanoviUPeriodu.pdf"); OutputStream out = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint,out); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now