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

Juriy

Members
  • Posts

    19
  • Joined

  • Last visited

Juriy's Achievements

Apprentice

Apprentice (3/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. Just a last repost. Please give some suggestions!
  2. I solved similar problem by introducing an opaque element that is printed on the top of crosstab when there is no data. Here is the snippet: Code: <staticText> <reportElement mode="Opaque" x="0" y="0" width="842" height="300" backcolor="#ffffff" style="Normal"> <printWhenExpression> <![CDATA[new java.lang.Boolean($V{REPORT_COUNT}.intValue() == 0)]]> </printWhenExpression> </reportElement> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="18"/> </textElement> <text><![CDATA[No data for the report]]></text> </staticText>
  3. dencel wrote: Thanks, that is good tip. But I am doing some editing on the pdf doc using iText. I am creating A5 size prints using Jasper and then reformat them on a A4 thus saving the company some printingcosts ;). As far as I know this is not possible using Jasper (?). Ehhh? You arrange two A5 reports on a single page, am I right? If so - nice trick! I'm not quite sure, but I guess you can achieve this with subreports.
  4. Why you just don't export your report directly to printer? Here's a snippet: Code:JasperPrint print = (JasperPrint) JRLoader.loadObject(new File("reports/fill/example1.jrprint"«»)); PrinterJob job = PrinterJob.getPrinterJob(); PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null); int selectedService = 0; for(int i = 0; i <services.length;i++){ if(services.getName().contains("HP"«»)){ selectedService = i; } } System.out.println("Selected " + services[selectedService].getName()); job.setPrintService(services[selectedService]); PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet(); MediaSizeName mediaSizeName = MediaSize.findMedia(4, 4, MediaPrintableArea.INCH); printRequestAttributeSet.add(mediaSizeName); printRequestAttributeSet.add(new Copies(1)); JRPrintServiceExporter exporter; exporter = new JRPrintServiceExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE, services[selectedService]); exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET, services[selectedService].getAttributes()); exporter.setParameter(JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET, printRequestAttributeSet); exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE); exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, Boolean.FALSE); exporter.exportReport(); System.out.println("Done"«»);
  5. UP. (Sorry for reposting, but customer _really_ wants me to do that report)
  6. Hi! I've got a problem, while exporting my report to xls format. All the charts seems to be in ugly quality: they look like heavily compressed or blurred. There is no such problems with other formats. Below is the piece of code I use to export to excel: Code:JRExporter exporter = new JExcelApiExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, getFilledReport()); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "reports/crosstab.xls"«»); try { exporter.exportReport(); } catch (JRException e) { e.printStackTrace(); } Thanks in advance for your help.
  7. OK, I got it. "JasperReports Reporting for Java Developers", page 146, "Built-in Report variables". It says: PAGE_COUNT Contains the total number of pages in the report. PAGE_NUMBER Contains the current page number.
  8. I've seen it in "JasperReports for Java Developers". I'm not quite sure, so I'll check it once more today and post the result.
  9. Juriy

    $X and $P!

    Thanks a lot! That explains everything!
  10. Maybe it would be easier to include all the libraries from /lib and /dist folders from the distribution, and then try to compile the report. If everything is OK, then exclude libraries one by one, until you find one that causes the problem. Download "project" distribution. It includes all necessary libs.
  11. So, when you hardcode param values in the query - you see the data in the report. And you're passing your parameters in the same format, as you hardcoded them. And it doesn't work with params? My boss says "There's no miracles in IT". ;) Try to output passed params values in the report. Compare the values with those you've hardcoded. I guess you will find some differences. BTW, what version of jasperreports engine do you use?
  12. Hmm, that's a bit strange. I've got this code perfectly working for me: Code:... Map parameters = new HashMap(); parameters.put("dateFrom", "01.01.2007"«»); parameters.put("dateTo", "01.04.2007"«»); ... And then <parameter name="dateFrom" class="java.lang.String" /> <parameter name="dateTo" class="java.lang.String" /> Code:[code]<queryString> <![CDATA[select * from myschema.mytable t where t.dateofaddingrecord between TO_DATE($P{dateFrom}, 'dd.mm.yy') and TO_DATE($P{dateTo}, 'dd.mm.yy')]]> </queryString> Maybe the problem is not in DateFormat? Have you tried to execute your query at the actual DB with appropriate parameters? If you are absolutely sure that your query is correct and it is actually returns data - use sqlMonitor (from TOAD distribution) to monitor the query that is actually sent by JasperReprots. Try to hardcode the parameters right in the query and create the report. Is there any data in it?
  13. Why do you use: d2 = df.parse("10 april 2007"); result2 = df.format(d2); instead of simply d2 = "10 april 2007"; ??? As I see - the problem is that you pass your date in "dd MMM yyyy" format, and oracle expects 'dd/mm/yy' format: TO_DATE($P{first_date}, 'dd/mm/yy') Try to do it like this: result2 = new SimpleDateFormat("dd/MM/yyyy").format(d2);
  14. Yeah, I've encountered this issue in the book. I guess it is a typo. You can use PAGE_COUNT to enumerate the records at the page or maybe to do something more artistic :) I've seen an issue that describes how to add zebra background to report: all even rows appear at the light background, and odd rows appear at the dark background.
  15. I guess google knows the answer ;) http://www.google.com/search?hl=en&q=JasperReports+Oracle+stored&btnG=Google+Search
×
×
  • Create New...