April 2018
Intermediate to advanced
202 pages
4h 48m
English
The JasperPrint instance can be exported to several formats. Since we are interested in rendering the report in a Vaadin web application, we can export the report to HTML and use a Label configured with ContentMode.HTML as follows:
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()HtmlExporter exporter = new HtmlExporter();exporter.setExporterOutput(new SimpleHtmlExporterOutput(outputStream));exporter.setExporterInput(new SimpleExporterInput(print));exporter.exportReport();outputStream.flush();Label htmlLabel = new Label("", ContentMode.HTML);htmlLabel.setValue(outputStream.toString("UTF-8"));
The HtmlExporter class sends its output to an OutputStream, which we can convert to String and set as a
Read now
Unlock full access