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

imation3m

Members
  • Posts

    4
  • Joined

  • Last visited

imation3m's Achievements

Rookie

Rookie (2/14)

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

Recent Badges

0

Reputation

  1. I am getting the following error when i try to call a subreport from my java application. when i run my report from iReport IDE it runs fine but when i try to run it from my java application i am getting this error: ( The report is crosstab report ) 16 [AWT-EventQueue-0] ERROR digester.Digester - Parse Error at line 217 column 67: Attribute value "Branch Name" of type NMTOKEN must be a name token. org.xml.sax.SAXParseException: Attribute value "Branch Name" of type NMTOKEN must be a name token.
  2. When i send a request to printer, i want to set printer's advanced printing options also, like: -Paper size -Cut Mode How can i set these advanced printing options? I am trying the following code to get printer attributes, but its not returning advanced printing options, only normal printing options. Code: PrinterJob job = PrinterJob.getPrinterJob(); // Create an array of PrintServices PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null); int selectedService = 0; // Scan found services to see if anyone suits our needs for(int i = 0; i < services.length;i++){ if(services.getName().toUpperCase().equalsIgnoreCase(KioskFrame.PRINTER_MINI)){ //If the service is named as what we are querying we select it selectedService = i; } } try { job.setPrintService(services[selectedService]); } catch (PrinterException ex) { ex.printStackTrace(); } PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet(); // For Testing purpose start //setPrintRequestAttributes(printRequestAttributeSet); PrintServiceAttributeSet set = services[selectedService].getAttributes(); Attribute[] attrib = set.toArray(); System.out.println("Size> " + set.size() + " length= " + attrib.length); for(int i=0; i < attrib.length; i++) System.out.println( attrib.getName() + "=" + attrib.getCategory()); Post edited by: imation3m, at: 2007/08/13 08:40 Post edited by: imation3m, at: 2007/08/13 08:42
  3. i followed the instructions u mentioned but its not working. Report containig master and subreport doesnt show up and gives "Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space" while filling the report. Both master and sub reports use JRBeanCollectionDataSource as their data source. Interestingly when i call the master report separately without it containg the sub reports, it run fine and also when i try to rub the sub report standalone it works also too. The problem is when i integrate the sub report in master, it doesnt show up. ======================================= ***** Master report paramters ***** *********************************** <parameter name="subReportDataSource" isForPrompting="false" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/> <parameter name="subreportA" isForPrompting="false" class="net.sf.jasperreports.engine.JasperReport"/> ======================================= ======================================= ***** Subreport element in master report **** ********************************************* <subreport isUsingCache="true"> <reportElement x="0" y="67" width="190" height="40" key="subreport-1"/> <dataSourceExpression><![CDATA[$P{subReportDataSource}]]></dataSourceExpression> <subreportExpression class="net.sf.jasperreports.engine.JasperReport"> <![CDATA[$P{subreportA}]]></subreportExpression> </subreport> =============================================== ========================================= ***** My java code **************** *********************************** ArrayList miniStatement = new ArrayList(); ArrayList miniStatementDetail = new ArrayList(); MiniStatementBean customerBean = new MiniStatementBean(); customerBean.setAccount(selectedAcctNumber); MiniStatementDetailBean detailBean = new MiniStatementDetailBean(); detailBean.setTranDate("12/12/12"); detailBean.setTranName("abc"); detailBean.setAmount("12222"); miniStatementDetail.add(detailBean); miniStatement.add(customerBean); // Master Data source JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(miniStatement); // Subreport Data source JRBeanCollectionDataSource dsDetail = new JRBeanCollectionDataSource(miniStatementDetail); String subReport= "reports/ministatementdetail.jrxml"; String subReportFile= JasperCompileManager.compileReportToFile(subReport); jasperSubReport=(JasperReport)JRLoader.loadObject(subReportFile); jasperReport=JasperCompileManager.compileReport("reports/ministatement.jrxml"); Map paramters = new HashMap(); paramters.put("subReportDataSource", dsDetail); paramters.put("subreportA", jasperSubReport); jasperPrint=JasperFillManager.fillReport(jasperReport, paramters, ds); JasperViewer.viewReport(jasperPrint, false); =========================================
  4. Ive created a report that uses JRBeanCollectionDataSource as its datasource. This report also contains a detail subreport that uses JRBeanCollectionDataSource(ArrayList) as its data source. The problem is that when i run this report from my java code it hangs while filling subreport and give out of memory error. On subreport datasource expression i m doing this: new JRBeanCollectionDataSource((ArrayList)$F{detailNestedBean}) How can i run such kind of report? My java code is as follows: ==================== ArrayList miniStatement = new ArrayList(); ArrayList miniStatementDetail = new ArrayList(); //Filling detail bean MiniStatementDetailBean detailBean; for( int i = 0; i < 2; i++) { detailBean = new MiniStatementDetailBean(); detailBean.setTranDate("28-02-07"); detailBean.setTranName("20060970068192ATM"); detailBean.setAmount("1,500.00-"); miniStatementDetail.add(detailBean); } MiniStatementBean customerBean = new MiniStatementBean(); customerBean.setAccount("100300001670201"); customerBean.setCardNumber("6393570000001130"); customerBean.setCurrency("PKR"); customerBean.setDate("27/03/2007"); customerBean.setStan("060711"); customerBean.setTerminalId("00000006"); customerBean.setTime("14:22:18"); customerBean.setDetailNestedBean(miniStatementDetail); miniStatement.add(customerBean); JRBeanCollectionDataSource dsMaster = new JRBeanCollectionDataSource(miniStatement); JasperReport jasperReport; JasperPrint jasperPrint; try { jasperReport = JasperCompileManager.compileReport("reports/ministatement.jrxml"); java.io.File f = new java.io.File("reports/ministatementdetail.jasper"); Map parameters = new HashMap(); parameters.put("SUBREPORT_FILENAME", f.getAbsolutePath()); jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, dsMaster); //runReport(customParameters,reports/patients_pay_sum.jrxml"); JasperViewer.viewReport(jasperPrint, false); } catch (JRException e) { e.printStackTrace(); } ====================
×
×
  • Create New...