Page 1 of 1

A ReportLogo senario

Posted: Wed Mar 26, 2008 6:16 am
by Ajax
Each of my reports have a Image control on the PageHeaderBand1.
I need to set the Image control through code.
How do I find the image control in a report document.

A ReportLogo senario

Posted: Wed Mar 26, 2008 7:21 am
by Ajax
Ans:
FileStream stream = null;
Image bmp = null;
string fileName ="D:\\Reports\\Settings\\Logo\\Company_Logo.jpg";

try {
stream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
byte[] buf = new byte[stream.Length];
stream.Read(buf, 0, buf.Length);
bmp = Image.FromStream(new MemoryStream(buf));
}
catch {}
finally {
if (stream != null) {
stream.Close();
}
}


foreach (StiComponent component in ReportLayout.Pages[0].GetComponents()) {
if (component is StiImage) {
StiImage ctlCompanyLogo1 = (StiImage) component;
ctlCompanyLogo1.Image = bmp;
ReportLayout.Compile();
}
}