Compartilhar via


How to: Add a Data-Bound Image (Image Wizard)

This topic provides instructions for adding image files to the body of a report. For more information about adding data-bound images to a header or footer, see Adding a Page Header and Footer to a Report.

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. To remove the OLE header from the image, you can set the value of the Image to this expression:

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

To set the expression, you must first use the Image Wizard to add the image to the report. You can then open the Properties window, select the image, and paste the expression into the Value field.

To add a data-bound image

  1. In Layout view, in the Toolbox, click Image.

  2. On the design surface, drag a box to the size you want the image to be. Alternatively, click the design surface to create an image item of fixed size.

  3. On the Welcome to the Image Wizard page, click Next.

  4. On the Select the Image Source page, click Database, and then click Next.

  5. On the Specify the Image Field page, do the following, and then click Next:

    • In Dataset, select the dataset in which the image field exists.
    • In Image field, select the field that contains the image.
    • In MIME type, select the Multipurpose Internet Mail Extensions (MIME) type of the image.
  6. On the Completing the Wizard page, verify the information, and then click Finish.

See Also

Concepts

Adding an Image to a Report
Report Designer How-to Topics

Other Resources

Report Designer F1 Help

Help and Information

Getting SQL Server 2005 Assistance