Up until now I’ve been talking about data and code that generates it with Data Methods . In this post, I’ll show you how to put images into your reports.
First let’s get an image.
I found one of the sample Windows 7 pictures and made it smaller
and then placed that image on my My Pictures folder on the SSRS server.
Now lets go back into Visual Studio. I have a simple report defined that renders a table.
The report looks like this when previewed …
Now let’s just add an image to the report by selecting the Images node and clicking Add Image
An Image was created called “Image1” – Just rename this to flowers
And examine its properties
Now we need to select the flowers.png file. How? It isn’t obvious at all – you need to click on the field called Base64 Data
And then select a suitable bitmap
And now you’ll see that the bitmap is loaded into the report.
At this point you are expecting me to somehow drag this image into the report or use it as the background of some thing on the page – but that’s not possible. Auto Design reports weren’t created to let you put things like images on a page. We need to move into the more complicated world of Precision Design reports.
Fortunately, our work on the original report is NOT wasted. We can transform the Auto Design into a Precision design very easily.
Just right-click on the Auto Design and select Create Precision Design
This will create keep the existing Auto Design but create a new Precision design that is an exact copy of the Auto Design…
And if you preview it …
You’ll see, that it does indeed look exactly like the original AutoDesign – it even has “AutoDesign1” as the title.
The Precision design editing experience is much different though. We can access it by double-clicking on the precision design or right-clicking it and selecting Edit Using Designer
And now we see the Precision Design editing surface. As you can guess, now that we have a surface we can place report elements exactly where we want them. We get exact control over placement but at the cost of simplicity.
There’s nothing in the UI that shows what we can put on the surface yet. So, from the View menu select Toolbox
And now a list of report elements is available for you to use
Click and hold down on the Image element in the Toolbox
And drag it onto the white area of the Precision Design
This will leave a tiny icon there. The red x icon appears because we haven’t selected a valid image yet.
With the image selected, look at the properties window. The Source property is set to External.
Because we added (embedded) the flowers.png file to the report change the Source property to Embedded.
And then expand the Value property and pick “Flowers”
Even without previewing it, you’ll see the flowers show up in the design surface
And naturally this works when previewed …
What if the image isn’t embedded but is sitting somewhere else – for example on the IIS server that is on the same box as the SSRS server. In this case, I placed kkoalas.png into an folder in the default web site.
And validated that I can see the picture when browsing the website with IE.
Now go back to the properties for the image we put on the report
And set the Source to External
And click on the Value property
Which lets you type into the field directly
And enter the url … http://isotopex/images/koala.png
And then the design surface will update … to have 100% more Koala
And this is visible in preview, of course
In this Koala example, the bitmap was on the same server as the SSRS server, we can also point SSRS at images on remote machines
Go to the microsoft website …
Find an image you want, and right-lick to see its properties
And you can see the URL there in the Properties dialog
Select the text, right-click, and choose Copy
Go back to your report …
And change the Value property …
To the new URL …
And there you go …
NOTE: To fetch images remotely requires that the SSRS Execution account be set correctly (Adding an Image to a Report)