Page 1 of 2

image in web report

Posted: Thu May 22, 2008 2:02 pm
by Roger
Hi,

In Designer it is possible to show an image as a header in the report.
Once I copied the report to the website and view it online the image has disappeared.
The Designer offers several ways to include an image in the report.
I have tried them all.

What is the best way to include an image as a header in the report.

Thanks in advance!

roger

image in web report

Posted: Thu May 22, 2008 3:45 pm
by Edward
The best way to show images in StiWebViewer is ImageURL property. Also please try to increase time of the ServerTimeout property.

Thank you.

image in web report

Posted: Tue May 05, 2009 4:19 am
by james
hi dears,

i have a report with an image to show information of employees in web.
i use ImageURL property to show image, also i save name of image in database.

public void imgEmp__GetImageURL(object sender, Stimulsoft.Report.Events.StiValueEventArgs e)
{
e.Value = HttpContext.Current.Server.MapPath("~/EmpImages/") + ToString(sender, Emp.EmpPhoto);
}

but unfortunately i can't load images in WebViewer.

could you please help me

image in web report

Posted: Tue May 05, 2009 4:23 pm
by Jan
Hello,

If you enter in ImageURL property path to image it work?

Thank you.

image in web report

Posted: Wed May 06, 2009 4:41 am
by james
thanks a lot

i have exported my report in a C# file and use that in my web application.
i changed code :

this.imgEmployee.ImageURL = new StiImageURLExpression(HttpContext.Current.Server.MapPath("~/EmployeeImages/abc.jpg");

but i could not load image in viewer.

image in web report

Posted: Wed May 06, 2009 5:49 pm
by Edward
Hi James,

Please assign the following property:

Image1.ImageURLValue = "http://www.myurl";

It is possible also in the code of the report, i.e. in the BeforePrintEvent of the page.

Thank you.

image in web report

Posted: Sat May 09, 2009 1:46 am
by james
hi dear Edward . sorry for my delay.

i changed my code:
this.imgEmployee.ImageURLValue = "d:\abc.jpg";

it did not work, after that i changed my code again:
public void Page1_BeforePrint(object sender, System.EventArgs e)
{
this.imgEmployee.ImageURLValue = "d:\abc.jpg";
}
but StiWebViewer did not load image.

i changed Stimulsoft assembly to last version and test previous actions, but ...

i don't know what can i do to solve my problem!!

thanks

image in web report

Posted: Mon May 11, 2009 1:39 am
by Edward
Hi James,

Was the folder you tried to access accessible? Maybe the path was not correct?

Thank you.

image in web report

Posted: Wed May 13, 2009 5:18 am
by james
hi

the path is real and correct, i tested it:

this.imgEmployee.ImageURLValue = "~/img.jpg";
or
this.imgEmployee.ImageURLValue = "d:\img.jpg";

but i can not do that.:amazed:

by the way, i have Stimulsoft.Report 2007 and use it.
does it work well?

Thank you

image in web report

Posted: Mon May 18, 2009 3:01 am
by Jan
Hello,

Please add following method in your report code:

Code: Select all

public static Image LoadBitmap(string url)
{
	WebClient cl = new WebClient();
	cl.Credentials = CredentialCache.DefaultCredentials;
	byte [] bytes = cl.DownloadData(url);
        cl.Dispose();

	MemoryStream stream = new MemoryStream(bytes);
        return new Bitmap(stream);
}
Also you need add usings to:

Code: Select all

System.IO
System.Net
After then in BeforePrintEvent of image component:

Code: Select all

Image1.ImageToDraw = LoadBitmap("http://www.stimulsoft.com/Images/Logo/stimulsoft.logo.png");
Thank you.