A ReportLogo senario

Stimulsoft Reports.NET discussion
Post Reply
Ajax
Posts: 26
Joined: Wed Mar 12, 2008 11:41 pm

A ReportLogo senario

Post 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.
Ajax
Posts: 26
Joined: Wed Mar 12, 2008 11:41 pm

A ReportLogo senario

Post 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();
}
}
Post Reply