Dynamically link an StiImage

Stimulsoft Reports.WEB discussion
Post Reply
sbd_jeff
Posts: 27
Joined: Fri Nov 08, 2013 9:39 pm

Dynamically link an StiImage

Post by sbd_jeff »

Hi Stimulsoft,
In the past, with Crystal 10, I was able to associate an image at runtime while the report was being rendered record by record. This was ideal because our images are not stored in the database, but are simply a link to where the file resides (ex. "C:\pictures\apic.bmp"). We lost this ability in Crystal 11 and beyond, but Stimulsoft has shown much more promise.

I would like to be able to do processing on a report on each datarow as it is rendered, but I have not found an event that allows me to do that.
My current approach is to render the report with a default image, and then iterate through each page while searching for the image controls.
I'm able to find the image control and set a file path to the image I want rendered, however once I have specified the image path I have not found a way to render the new image.
Ex:

Code: Select all

if (component.GetType() == typeof(StiImage))
{
   image = (StiImage)component;
   image.File = @"C:\Temp\IMAGE_TESTING\BUGS.bmp";                        
}
I've tried using image.Render() and image.Reset(), but I have had no luck in changing the image after the report is rendered.

So my questions are:
Is there a way to interrogate each data row as it is rendered?
If not, is there a way to set an image path on an image component after the report has been rendered and have it display the new image?

If neither is possible, is there a way to set an image at runtime per record when only a string (path to the image) is given? The images are not stored in the database.

Thank you for all of your help!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Dynamically link an StiImage

Post by HighAley »

Hello.

Why don't you set the File property in the Before Print event of the Image.
You could use code like next:

Code: Select all

Image1.File = @"C:\Temp\IMAGE_TESTING\BUGS.bmp";
Thank you.
Post Reply