April 27, 2009 at 5:38 am
Hi,
I have developed a report which has a column for displaying image. I need to pass the image file path and name to the image object used. Now, my required is the image file may be of any type i.e. gif, jpg, bmp, etc. I want to find which type of file is available so that i can pass the correct file name to the image object on my report.
For this, i have written a custom code which seach for image file, its type and accordingly pass the name to the image object. When i integrate the custom assembly some how it does not gives proper output.
Secondly, whenever i do any changes in my custom code and re-integrate the DLL, reports does not show/implements the changes done.
Any help in this regards will be appreciated.
Thank You
April 30, 2009 at 1:47 pm
First you could use JPEG and GIF but BMP is not good because I had a report with 13 images and I had problem with BMP had to convert those to JPEG and Gif as needed. There are limited options with image in SSRS because the image control is very limited. Here is a link with some options that may help you, get started and post again, you always have the option to put the images in a database and put it in a rectangle.
http://blog.toddtaylor.com/PermaLink,guid,b1517702-ad4b-48e1-a6e3-b736e8a982cb.aspx
Kind regards,
Gift Peddie
May 7, 2009 at 1:29 am
Thanks for the reply.
My requirement is bit different. Let me explain it in detailed.
I have a column say "ImageName" that identifies the image to be display. For e.g. The column contains value such as "Abc.gif" or "Abc.jpg" or "Abc". Now, for first two values where the file extension is available there is no problem in displaying the correct image.
The problem occurs when we don't have any extension to the column value i.e "Abc" in this case.
Here, i need to append all possible extension to the column value and find which extension file is available. For doing this i have written custom code shown below.
public string FindImage(string FileName, string FilePath)
{
string returnValue = "Not Found";
if (System.IO.File.Exists(FilePath + FileName + ".gif"))
{
returnValue = FilePath + FileName + ".gif";
}
else if (System.IO.File.Exists(FilePath + FileName + ".jpg"))
{
returnValue = FilePath + FileName + ".jpg";
}
else if (System.IO.File.Exists(FilePath + FileName + ".png"))
{
returnValue = FilePath + FileName + ".png";
}
return FilePath;
}
But the above custom code always return string "Not Found" even if the file existings with .png extension. I think the System.IO.File.Exists function some how does not work properly under the custom code.
I want to know how built-in .net assembly functions to be used in custom code.
Thanks,
-Sandeep
May 7, 2009 at 4:58 pm
I don't think your requirements are valid in SSRS beause you are using System.IO and filepath, SSRS looks for image within SSRS or project so you need to change what you are doing.
Kind regards,
Gift Peddie
May 7, 2009 at 10:53 pm
Hey, i have written this code in a custom assembly and using this assembly in SSRS.
Thanks,
-Sandeep
May 8, 2009 at 9:00 am
I need to explain a little when you are using images in .NET you need to use memory stream but you are just moving the image with filepath that may be the reason for your problem. And if it is working this thread is not needed.
Kind regards,
Gift Peddie
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply