{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner

Print JasperReport Without A DataSource

This is a method that fills a Jasper Reports .jasper file using only parameters.  No Data Source is needed.  Note: "module" is an object whose fields are used as the parameters to the report.  The method also calls JasperViewer.viewReport which starts the embedded Jasper Reports viewer.  This could be replaced with a method to export the report or anything else.

private void printCertsActionPerformed(java.awt.event.ActionEvent evt) {                                           
        File reportFile = new File("report1.jasper");
        Map parameters = new HashMap();
        parameters.put("partNum", module.getPartNum());
        parameters.put("moduleType", module.getModuleType());
        parameters.put("area", module.getArea());
        parameters.put("membraneType", module.getMembraneMaterial());
        parameters.put("channelHeight", module.getChannelHeight());
        parameters.put("controlNum", cnField.getText());
        try {
            JasperPrint print = JasperFillManager.fillReport(reportFile.getPath(), parameters, new JREmptyDataSource());
        } catch (JRException ex) {
            Logger.getLogger(TestDashboardView.class.getName()).log(Level.SEVERE, null, ex);
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks