Jasperreports - Is it possible for a report to be automatically listed several times?

Asked

Viewed 106 times

0

I have a report that is nothing more than a receipt, with its items and data of the note and the items. A feature was requested that when selecting more than one invoice, this report manages the template of each note in a PDF only so that the user massively prints the list of selected banknotes.

I looked at the Jasperreports website and tried to use sub reports by copying the contents of the other JRXML (iReport source), tried some method of using this JRXML as embedded content in the other report listing my objects on top of it, but also without success. Is it possible for this to be done? If so, how?

  • The correct is to use the subreport, publish your jrxml and its classes so that I can analyze.

  • What classes do you want? I can already pass the JSON object to the individual report successfully. And I can also pass a list of JSON objects to the other report also without problems, I just can’t generate the list of reports being read each of these objects.

  • I want to see how you are passing your 'invoice' class to Jasper and the jrxmls themselves.

1 answer

0

If there are multiple reports and you just want to export them all together you can use the example of batch export from Jasper as per this link: http://jasperreports.sourceforge.net/sample.reference/batchexport/index.html

A possible example would be:

    ByteArrayOutputStream os = new ByteArrayOutputStream();
    JRPdfExporter pdfExporter = new JRPdfExporter();
    pdfExporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, jasperPrintList);
    pdfExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, os);
    pdfExporter.setParameter(JRPdfExporterParameter.IS_CREATING_BATCH_MODE_BOOKMARKS, Boolean.TRUE);
    pdfExporter.exportReport();
    InputStream is = new ByteArrayInputStream(os.toByteArray());

Where jasperPrintList would be a list of Jasperprint-like objects that you get by giving Fill in the report as follows

JasperPrint impressao = JasperFillManager.fillReport("caminho_do_arquivo_jasper", new HashMap(), new JREmptyDataSource());

Browser other questions tagged

You are not signed in. Login or sign up in order to post.