Skip to main content



      Home
Home » Archived » BIRT » Report in jar file
Report in jar file [message #217326] Wed, 07 February 2007 04:04 Go to next message
Eclipse UserFriend
HI all,

I'm working on a RCP application and using Birt. I managed to make a report file and preview it with WebViewer.display(...).

Now I was wandering how can I pass my report file to the WebViewer (or to the Report Engine), if it was contained in the plugin jar file. I
would like to do this just like I load images from within the plugin jar file. Is this possible or ...?

Thanks,
Bojan
Re: Report in jar file [message #217456 is a reply to message #217326] Wed, 07 February 2007 10:25 Go to previous messageGo to next message
Eclipse UserFriend
I am not sure if this would work for you, but I load my reports using the
ClassLoader. Here is an example:

String reportFile = "com/yourcompany/yourapp/YourReport.rptdesign";

InputStream reportStream =
Thread.currentThread().getContextClassLoader().getResourceAs Stream();
IReportRunnable design = engine.openReportDesign(reportStream);

// Create task to run the report - use the task to execute and run the
// report
IRunAndRenderTask task = engine.createRunAndRenderTask(design);

task.run();


Obviously, the reports would have to be in your classpath, but if they are
in a jar file, I would assume you are including this jar in your classpath.

Good luck!
Re: Report in jar file [message #217469 is a reply to message #217456] Wed, 07 February 2007 11:04 Go to previous messageGo to next message
Eclipse UserFriend
This is exactly what I want.
I didn't go through the Report Engine API and didn't see that you could pass an InputStream to it.
Thanks.


Erica Jackson wrote:
> I am not sure if this would work for you, but I load my reports using
> the ClassLoader. Here is an example:
>
> String reportFile = "com/yourcompany/yourapp/YourReport.rptdesign";
>
> InputStream reportStream =
> Thread.currentThread().getContextClassLoader().getResourceAs Stream();
> IReportRunnable design = engine.openReportDesign(reportStream);
>
> // Create task to run the report - use the task to execute and run the
> // report
> IRunAndRenderTask task = engine.createRunAndRenderTask(design);
>
> task.run();
>
>
> Obviously, the reports would have to be in your classpath, but if they
> are in a jar file, I would assume you are including this jar in your
> classpath.
>
> Good luck!
>
Re: Report in jar file [message #217482 is a reply to message #217469] Wed, 07 February 2007 11:42 Go to previous message
Eclipse UserFriend
Great! I just noticed that I left something out in this line:

InputStream reportStream =
Thread.currentThread().getContextClassLoader().getResourceAs Stream();


It should be:

InputStream reportStream =
Thread.currentThread().getContextClassLoader().getResourceAs Stream(reportFile);


You probably already figured that out, but I figured I would correct it in
case anyone got confused.
Previous Topic:how to remove asterisk?
Next Topic:Text not justified in PDF(AGAIN!)
Goto Forum:
  


Current Time: Sat May 31 10:58:08 EDT 2025

Powered by FUDForum. Page generated in 0.06522 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top