Images via variables

Stimulsoft Reports.Flex discussion
Locked
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

Images via variables

Post by Chipo »

Hi,

can I populate image on report via report variables?

Idea is to define var on the report and before rendering set values for those variables, so report to display them.
Is it possible ?
What type of variables should be (String, Image, ...) ?
How to set source for image field on the report ?

Thank you for great job, reports are awesome.
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Images via variables

Post by HighAley »

Hello.

Yes, it;s possible.
You could use Image Data property.
Do you have any difficulties with it?

Thank you.
User avatar
Chipo
Posts: 44
Joined: Thu Sep 13, 2012 4:09 am
Location: Sydney, Australia

Re: Images via variables

Post by Chipo »

Hi,
this question pop up again.

I need to use images on the report. I can not use url to image resource, because it called for every report page (no caching).
The only option I have is to create report variable and populate it before the actual report rendering.

My questions:
1. What type of variable on the report it should be? (String or Image) I am going to use this variable as a value for the "Image Data" of Image component.

2. How I can populate its content?
Currently I do the following (this is not exact code but idea of what I do):

Code: Select all

var content:String = StiTypeConverter.byteArrayToBase64(byteArrayContent);
....
stiReport.dictionary.variables[...].valueObject = content;
Please advise what I do wrong. All described above does not work. Image is blank.

Best regards. Summer is coming :) (not for me :( wrong semisphere)
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Images via variables

Post by HighAley »

Hello.

It's possible to use JPEG or PNG images only.
Here is your code with some corrections:

Code: Select all

var png: PNGEncoder = new PNGEncoder();
var bytes: ByteArray = png.encode(bitmapData);  // byteArrayContent in your case, should be BitmapData

var content:String = StiTypeConverter.byteArrayToBase64(bytes);
....
stiReport.dictionary.variables[...].valueObject = content;
Thank you.
Locked