Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Change an image properties before the report generation
Change an image properties before the report generation [message #635451] Tue, 26 October 2010 20:24 Go to next message
FrenchGuy is currently offline FrenchGuyFriend
Messages: 2
Registered: October 2010
Junior Member
Hi,

I am generating a report using Report Engine classes and I would like to change the url of an image inserted in the report using BIRT Report Designer.

Is it possible to access this item and change its properties before the generation?

this is a sample of my code :
IReportEngine engine = null;
engine = Engine.getInstance().getEngine();
IReportRunnable design = null;
// Open the report design
try {
    design = engine.openReportDesign(report.getSource());
} catch (EngineException e) {
        LoggerBI.getInstance().fatal("", e);
        return false;
}
IRunAndRenderTask runtask = engine.createRunAndRenderTask(design);
ULocale lc = new ULocale(task.getLocale());
runtask.setLocale(lc);
runtask.setParameterValues(reportParams);
try {
     runtask.run();
} catch (EngineException e) {
     LoggerBI.getInstance().error("", e);
      return (false);
}
runtask.close();



Thanks!
Re: Change an image properties before the report generation [message #635691 is a reply to message #635451] Wed, 27 October 2010 17:51 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Yes this is possible. You can also change it in script.

In Java like this:

ReportDesignHandle report = (ReportDesignHandle) design.getDesignHandle( );
ImageHandle myimage =(ImageHandle)report.findElement("MyImage1");
myimage.setURL("\"http://tomcat.apache.org/images/tomcat.gif\"");

In the above example note that the image element has been named in the
general properties for the image.

in Script

//beforeFactory script

var img1 =reportContext.getDesignHandle().findElement("MyImage1");
img1.setURL("\"http://tomcat.apache.org/images/tomcat.gif\"");

Jason

On 10/26/2010 4:25 PM, FrenchGuy wrote:
> Hi,
>
> I am generating a report using Report Engine classes and I would like to
> change the url of an image inserted in the report using BIRT Report
> Designer.
>
> Is it possible to access this item and change its properties before the
> generation?
>
> this is a sample of my code :
>
> IReportEngine engine = null;
> engine = Engine.getInstance().getEngine();
> IReportRunnable design = null;
> // Open the report design
> try {
> design = engine.openReportDesign(report.getSource());
> } catch (EngineException e) {
> LoggerBI.getInstance().fatal("", e);
> return false;
> }
> IRunAndRenderTask runtask = engine.createRunAndRenderTask(design);
> ULocale lc = new ULocale(task.getLocale());
> runtask.setLocale(lc);
> runtask.setParameterValues(reportParams);
> try {
> runtask.run();
> } catch (EngineException e) {
> LoggerBI.getInstance().error("", e);
> return (false);
> }
> runtask.close();
>
>
>
> Thanks!
Re: Change an image properties before the report generation [message #635860 is a reply to message #635451] Thu, 28 October 2010 11:52 Go to previous message
FrenchGuy is currently offline FrenchGuyFriend
Messages: 2
Registered: October 2010
Junior Member
Ok. Thanks!

I'll try this.
Previous Topic:Is it possible to change a grid in its grid event handler (java)
Next Topic:How to create powerpoint and excel exports?
Goto Forum:
  


Current Time: Thu Mar 28 23:15:19 GMT 2024

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

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

Back to the top