Adding Images to your ReportThere are 3 ways in which you can add images to your report
1. Embeded
2. External
3. Database
Embeding ImagesOpen your report. Drag and drop an image icon.
Click on the image and press F4, the properties window pops up
Under the group
data you'll find
source choose
embeded.
To embed images to your report choose
report property on the menu (Click on the report if you can't see this),
Click on
Report Images and choose the images you want to embed.
Now, In the value property of your image choose the image you want to display.
Embedded images are ok for small logo files, but for huge bmp files
external images work better.
External ImagesSet the
source as
external and set the value for external files as the
virtual path to the image folder. ex: http://servername/imagefoldername/imagename
Also enable external images in your aspx page
ReportViewer1.LocalReport.EnableExternalImages = TrueDatabase ImagesSet the
source as
Database and set the value for external files as the
fieldnameIn the textbox write the foll expression.
=Convert.ToBase64String(Fields!Image.Value)
Placing a database image in your headerSince database fields are not accessible from the header, place a hidden textbox in your report call it tb_images and set the value, as mentioned above for database images. Now place an image icon in the header and set its value to the hidden image textbox i.e
=ReportItems!tb_Image.Value
Dynamically Change ImageIn certain case you may have to dynamicaaly place a header image based on the department.
The code can be placed in a code window. Select Report -> Report Properties -> Code (tab) in the VS.NET designer.
Function ShowHeaderImage(value as Object) As String
Dim strURL as String = "http:///images/"
Dim strImg as String
Select Case value
Case Nothing
strImg = "heading1.jpg"
Case 1
strImg = "heading2.jpg"
Case 2
strImg = "heading3.jpg"
End Select
Return strImg
End Function
Place an image icon in the report body and set its source as
external. In the
value property
enter the following
=Code.ShowHeaderImage(Fields!
.Value)