Hi,
I created a JasperReport and saved the .jrxml at <reportLocation>. It was no problem to write a Java program which creates a PDF file from this report.
But now I want to write a Spring Boot Project to stream this report to a Tomcat Server, to show it in the browser.
But the output has the wrong format. It looks like this:
It should have HTML layout. How can I do that?
Another problem that I have is that if the report is to long, it doesn't fit in the outputStream and I get an Error.
This is my SpringBootApplication:
@SpringBootApplication @Controller public class TestProject2Application { @RequestMapping(method = RequestMethod.GET) @ResponseBody public void RepPerformance2(OutputStream outputStream) { // create a database connection MyOracleConnection conManager = new MyOracleConnection("jdbc:oracle:thin:@/..."); Connection con = conManager.openConnection(...); // create the report reports.createReport(outputStream); // close database connection conManager.closeConnection(con); } public static void main(String[] args) { SpringApplication.run(TestProject2Application.class, args); } }
This runs my JasperReport:
private boolean runReport(String reportLocation, HashMap<String, Object> parameter, OutputStream outputStream) { parameter.put(JRParameter.REPORT_VIRTUALIZER, virtualizer); try { JasperReport jasperReport = JasperCompileManager.compileReport(reportLocation); JasperFillManager.fillReportToStream(jasperReport, outputStream, parameter, con); } catch (JRException ex) { System.out.println("JRException"); ex.printStackTrace(); return false; } virtualizer.cleanup(); return true; }
Thanks for your ideas,
Rebecca
0 Answers:
No answers yet