Jump to content
We've recently updated our Privacy Statement, available here ×

andrew.bengier

Members
  • Posts

    3
  • Joined

  • Last visited

andrew.bengier's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Sorry for the confusion - getJasperSubReportTemplate returns a byte[] for the template.
  2. Read that one... Thats why i tried adding dataModel.put( "SUBREPORT", subreport );[/code]Thanks though, I am going to try a workaround for now. I will try ot run both the main report and subreport separately and for pdf stitch them together and for excel see if the requirements allow me to make separate sheets.
  3. So i have a jasper report that contains a subreport. When i run it in iReport or JasperStudios ( i have two versions one with uuid's and one legacy but otherwise the same ) it works. When i add the reports, main and subreport to my java I am getting the following - net.sf.jasperreports.engine.JRException: Resource not found at: ./Subreport.jasper. I am filling the report: //JasperReportModel Class private Map<String, Object> mpModel; private String jsonArray; private String jasperTplPath; private String format; private byte[] jasperTemplate;//Service classJasperReportModel jasperReportModel = getJasperReportModel( dataModel, reportName, jsonArray, format );byte[] report = generateReport( jasperReportModel );private JasperReportModel getJasperReportModel( Map<String, Object> dataModel, String reportName, JSONArray jsonData, String format ) { try { jasperTemplate = getJasperTemplateByteArray( reportName, format ); subreport = templateUtil.getJasperSubReportTemplate( reportName ); if( subreport != null ) { dataModel.put( "SUBREPORT", subreport ); } JasperReportModel jRptModel = new JasperReportModel( reportModel, jsonData.toString(), jasperTemplate, format ); return jRptModel; } catch( IOException e ) { e.printStackTrace(); throw new RuntimeExcaption(); }}private byte[] generateReport( JasperReportModel jrptModel ) { map<String, Object> mpReportModel = jrptModel.getMpModel(); JsonDataSource jsonDataSource = new JsonDataSource( jrptModel.getJsonArray() ); mpReportModel.put( "REPORT_DATA_SOURCE", jsonDataSource ); JasperPrint jasperPrint = JasperFillManager.fillReport( jasperTemplate, mpReportModel ); jasperPrint.toByteArray();}[/code]Can someone tell me why i am getting a resource not found error if my .jasper and .jrxml files are all in the same folder. The only things that's not in that folder are JRM class and the service class.
×
×
  • Create New...