Jump to content

Recommended Posts

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted

Hi mahadiosb,

Thank you for comment.

I don't use any Subreport in my jrxml.

Sorry, I missed compileReport had exception before fillReport.

Even though removed all elements from sample.jrxml, compileReport failed.

1:    public static void main(String[] args) throws Exception {
2:    
3:        Map<String, Object> parameters = new HashMap<>();
4:        JRCsvDataSource dataSource = new JRCsvDataSource(JasperMain.class.getResourceAsStream("sample.csv"));
5:        dataSource.setUseFirstRowAsHeader(true);
6:        try (InputStream template = JasperMain.class.getResourceAsStream("sample.jrxml")) {
7:            JasperReport report = JasperCompileManager.compileReport(template);
8:            JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, dataSource);
9:            JasperExportManager.exportReportToPdfFile(jasperPrint, "sample.pdf");
10:        }catch (Exception e) {
11:            System.out.print(e.getMessage());
12:        }
13:    }
 

 

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...