File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jasper Reports - empty report

 
Melanie Jones
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an application that uses Jasper Reports to show contents from a table onto a PDF file. (basically a select * from some table with a where condition)

This is my problem. When the sql returns data the PDF is shows up correctly. The PDF is generated even when the database does not return any rows. A message stating "The file cannot be opened because it has no pages" is shown on the screen.

How do I avoid an empty report to be displayed. The byte array returned is not empty so the the report pops up the pdf.

Can you help me capture an empty report???

Thanks for your help!!!

Chris Jose
 
Chengwei Lee
Ranch Hand
Posts: 884
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When your query yields no results, there're 3 options that are provided by JR that you could make use of:
(a) generate empty report (PDF), i.e., no pages
(b) generate a single blank page report
(c) generate a report showing all sections, except the detail section

This can be done by setting the value of the attribute [B}whenNoDataType[/B] for element jasperReport. The 3 accepted values are:
(a) NoPages
(b) BlankPage
(c) AllSectionsNoDetail

Hope this helps.

Cheers!
 
Ania Pilecka
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to make a report without connectiing to database, only to pass parameters we want use in raport?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic