Export (0) Print
Expand All
Expand Minimize

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

  1. In Design view, on the Insert menu, click Image.

  2. Click a location on the design surface and drag the mouse to create a box that is the size of the desired image.

  3. In the General page of the Image Properties dialog box, type a name in the Name text box or accept the default.

  4. (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.

  5. In Select the image source, select Database.

  6. In Use this Field, select the field that contains the image.

  7. In Use this MIME type, select the MIME type of the image—for example, bmp. .

  8. Click OK.

    An image placeholder appears on the report design surface.

To remove the OLE header from an Access image

  1. Add an image from an Access data source as described in the previous procedure.

  2. In the Image Properties dialog box, click the expression (fx) button.

  3. 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.

  4. Click OK twice.

    An image placeholder appears on the report design surface.

Community Additions

ADD
Show:
© 2014 Microsoft