Company Logo on Report

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

Company Logo on Report

Post by Ajax »

I need a suggestion on how to go about with this senario.

I will but an image in a folder (C:\App\Report\Settings\Logo\CompanyLogo.jpg)

If I update this image i need it to reflect in the reports for this how do I add it to report header?

Image ?
File ?
Image URL ?

of an Image property ???
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Company Logo on Report

Post by Edward »

For the Web based reports using of Image URL would be the best.

Thank you.
Ajax
Posts: 26
Joined: Wed Mar 12, 2008 11:41 pm

Company Logo on Report

Post by Ajax »

For Windows Apps ?
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Company Logo on Report

Post by Edward »

For Windows Forms application it is ok to use any of this properties.

If you need replace the source image file, then you need to use the following technique in BeforePrintEvent of the Image1 component , to avoid locking of the source image file:

Code: Select all

Image bmp = null;
System.IO.FileStream stream = null;
string fileName = "C:\\App\\Report\\Settings\\Logo\\CompanyLogo.jpg";
try
{
	stream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
	byte[] buf = new byte[stream.Length];
	stream.Read(buf, 0, buf.Length);
	bmp = Image.FromStream(new System.IO.MemoryStream(buf));
}
catch
{
}
finally
{
	if (stream != null) stream.Close();
}
Image1.Image = bmp;
Thank you.
Ajax
Posts: 26
Joined: Wed Mar 12, 2008 11:41 pm

Company Logo on Report

Post by Ajax »

Thank you very much for the help.

Just tried it out now.

I feel you should the clip above as a FAQ to your documentation also,because this will be helpful.

I got one more q I'll try to post in a sep thread.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Company Logo on Report

Post by Edward »

You are welcome.

Let us know if any help is required.

Thank you.
Ajax
Posts: 26
Joined: Wed Mar 12, 2008 11:41 pm

Company Logo on Report

Post by Ajax »

For anyone else following this...

Senario:

Say I have a folder Report with subfolder which contain report and one subfolder with a logo of the company.

Report\EmpReports
....
...
.
Report\Settings\Logo

I need to change the logo from customer to customer..so I may make some way to add the logo.jpg file to Report\Settings\Logo (as a app option)

Now If I have a report viewer app where I select a report and render it to the viewer control.

How can I set the path for the logo in each report??


In the above mentioned code you can add

string fileName = Application.StartupPath + "\\Reports\\Logo\\Company_Logo.jpg";

This is one way to solve the issue,this way just put the new file there and report will get it from there.
Post Reply