Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Change images by code
boj
Hi,
I'm doing an app that generates reports with images. This images are generated so I need to change them each time I generate a report. How I can do it by code?
I'm using BIRT 2.3.1 and Eclipse Ganymede.
Thnx in advance,
boj
Find more posts tagged with
Comments
boj
I've found a partial solution.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
ReportDesignHandle design = null;
//Create a design engine configuration object.
DesignConfig dConfig = new DesignConfig( );
DesignEngine dEngine = new DesignEngine( dConfig );
// Create a session handle, using the system locale.
SessionHandle session = dEngine.newSessionHandle( null );
// Create a handle for an existing report design.
try {
design = session.openDesign( getDesignPath() );
} catch (DesignFileException dfe) {
dfe.printStackTrace();
} catch (Exception e) {
e.getMessage();
}
ImageHandle image = (ImageHandle) design.findElement(nameOfTheImage);
image.setFile(pathToImage);
// Save the design
try {
design.save();
} catch (IOException ioe) {
ioe.printStackTrace();
}
// Close the design
design.close();
</pre>
<br />
I can change the image with this code, but I need to know the nameOfTheImage, so next question is: How can I generate image names at the rptdesign file? I need it to be easy so anyone will be able to change the rptdesign and this continue working.<br />
<br />
Thnx in advance,<br />
<br />
boj