How to: Add a Data-Bound Image (Report Builder 2.0)
A report can include a reference to an image that is stored in a database. Such an image is known as a data-bound image. The pictures that appear alongside product names in a product list are examples of data-bound images.
Adding a data-bound image to a page header or page footer requires additional steps. For more information, see Adding Page Headers and Footers (Report Builder 2.0).
If you created or stored the image in Microsoft Access, the image includes OLE header information that prevents the image from displaying on the report page at run time. You can remove the OLE header by using the second procedure below.
To add a data-bound image
In Design view, on the Insert menu, click Image.
Click a location on the design surface and drag the mouse to create a box that is the size of the desired image.
In the General page of the Image Properties dialog box, type a name in the Name text box or accept the default.
(Optional) In the Tooltip text box, type text to display when the user hovers the mouse over the image in the report rendered for HTML.
In Select the image source, select Database.
In Use this Field, select the field that contains the image.
In Use this MIME type, select the MIME type of the image—for example, bmp. .
Click OK.
An image placeholder appears on the report design surface.
To remove the OLE header from an Access image
Add an image from an Access data source as described in the previous procedure.
In the Image Properties dialog box, click the expression (fx) button.
In the Expression dialog box, copy the following expression, with no line breaks, into the expression pane:
=System.Convert.FromBase64String(Mid(System.Convert.ToBase64String(Fields.ImageFieldName.Value),105))
The expression uses Mid to exclude the header information, which resides in the first 105 characters of the file, and then uses Convert to make the rest of the image base64 encoded. The expression assumes that the image originates in an EN-US database. If you are using a different collation, the OLE header might be longer or shorter than 105 characters.
Click OK twice.
An image placeholder appears on the report design surface.