Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error with JasperExportManager

 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello !

When I use
JasperExportManager.exportReportToXmlFile("classic.jasper", true)
method I am getting following error,

java.lang.ClassCastException: net.sf.jasperreports.engine.JasperReport

However it is generating .jrprint file, but nothing is getting printed.

How to solve this?

Thanks in advance.

Reg,
Chetan
 
san geetha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before exporting the report to either xml or excel sheet, you are required
to fill the report with the data.
Ideally speaking below mentioned are the steps in sequence:

1. Compile the .jrxml/.xml file to generate the jasper file
2. Fill the report by passing the .jasper file as a parameter
3. Export to desired report format by passing the .jrprint file as a
parameter and not the .jasper file (thatz why, ClassCastException)

If you are still confused,as i mentioned earlier please check the jasper
report samples. Open one of the build.xml file. u'll know when to use which
file.

Regards,
Sangeetha
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thx for replying but I have code same manner as you wrote.

See this.....



Let me know if something is wrong it the code.

Thx in advance.

Reg,
Chetan
 
san geetha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

try this!!!
JasperPrintManager.printReport("classic1.jrprint", true);
instead of passing the .jasper file...
Guess this shud work.

Please let me know the result.

Regards,
Sangeetha
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sangeetha!

Thx for reply. It is working now.

I was really runing sort of time and your ans was very cruise for me.

Thanks and Regards,
Chetan Parekh
 
san geetha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad, u got it rite.

Earlier i had posted a question titled
Jasper Reports - HyperLink
Please read the same and see if u can help me.

Thanks,
Sangeeta
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Sorry we were on company workshop last week.

Hey you can check following forum...
http://sourceforge.net/forum/forum.php?forum_id=113530

I seen similar req as you over there.

It might be helpful to you.

Reg,
Chetan
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic