|
|
Re: EmbeddedImage not added to report [message #759981 is a reply to message #759934] |
Wed, 30 November 2011 19:10 |
|
Embedded images are not shown unless they are used. Not certain that is
your issue, but have a look at the attached code. There is an addImage
method to add an embedded image. Once the image is added a Image report
item is created that uses the embedded image.
Jason
On 11/30/2011 10:38 AM, js wrote:
> I am trying to add an image to a report:
>
>
>
> EmbeddedImage embeddedImage = StructureFactory.createEmbeddedImage();
> String constFile = "C:\\tests\\sample_img.png";
> byte[] imageByteArray;
> try {
> imageByteArray = FileUtils.readFileToByteArray(new File(constFile));
> embeddedImage.setType(DesignChoiceConstants.IMAGE_TYPE_IMAGE_PNG);
> embeddedImage.setName("name");
> embeddedImage.setData(imageByteArray);
> templateHandle.addImage(embeddedImage);
> templateHandle.saveAs("c:\\tests\\test.rptdesign");
> } catch (IOException e) {
> e.printStackTrace();
> } catch (SemanticException e) {
> e.printStackTrace();
> }
>
>
> The code runs without any errors but when I open the test.rptdesign file
> the image is not there, why?
|
|
|
Powered by
FUDForum. Page generated in 0.03606 seconds