How to: Add Pictures to Reports

You can add pictures to the report or label page layout. For example, you can add a company logo to the page header of an invoice. You can add pictures from image files or contents from General fields to reports using the Picture/OLE Bound control.

Tip

When you want to add a picture that can vary depending on the record or a group of records, store the picture in a General field instead of a file. When you add the picture to the layout, add the picture by specifying the General field instead of a file. For more information, see General Field Type and How to: Add General Fields to Reports.

To add a picture to the page layout

  1. Open the report or label in the appropriate designer.

  2. On the Report menu, point to Insert Control, and click Picture/OLE Bound.

    The Picture/OLE Bound Properties dialog box opens.

    Note

    If the _REPORTBUILDER system variable is not set to the default Report Builder or is set to a third-party builder, the Report Picture dialog box displays or a different dialog box might display. For more information, see _REPORTBUILDER System Variable and Report Picture Dialog Box.

  3. In the Picture/OLE Bound Properties dialog box, click the General tab if it is not selected.

  4. In the Control source area, perform one of the following:

    • To use an image file on disk (or in your project) on a report layout, click Image file name. In the Control source box, type the name of the file and include the path if needed.

      Tip

      To browse for and select a file, click the ellipsis () button to display the Open Picture dialog box.

    • To use an image stored in a General field of a table, click General field name. In the Control source box, type the name of the General field containing the image.

      Tip

      To browse for and select a field, click the ellipsis () button to open the Expression Builder dialog box. The Expression Builder dialog box displays available fields when the report's data environment contains a table or view.

    • To use an expression (such as a string variable, a non-General character field, or a string literal) that resolves to the name of an image file, click Expression or variable name.

      Tip

      To build an expression or select a variable, click the ellipsis () button to opens the Expression Builder so that you can build an expression or select a variable. For more information, see Expression Builder Dialog Box.

    • To use an instance of a Visual FoxPro Image class as the source of an image on a report layout, click Expression or variable name., and enter a variable name containing an object reference to a form's Image control that has its PictureVal Property set appropriately.

      Tip

      The use of an Image object's PictureVal property as a image source in a report is only supported in object-assisted output mode. It will work in backward-compatible mode, in some cases, but results are not guaranteed. For example, in backward-compatible mode, Picture/OLE Bound controls with this source may not respect the Clip sizing option. For more information, see SET REPORTBEHAVIOR Command.

  5. When you are finished in the Picture/OLE Bound Properties dialog box, click OK.

    The Picture/OLE Bound report control appears in the Page Header band by default. After you add the control, you can move it by dragging it to the position you want.

    Tip

    You can add Picture/OLE Bound controls at the position you want by selecting them on the Report Controls toolbar and drawing them.

    If you specified an image file, the Picture/OLE Bound report control displays an image. If you specified a General field, the Picture/OLE Bound report control displays a generic frame. When you specify images, they retain their original size by default. For more information, see How to: Resize Report Controls.

For more information, see General Tab, Report Control Properties Dialog Box (Report Builder).

For an example of a report containing pictures, see the sample report Wrapping.frx in the Visual FoxPro directory, ...\Samples\Solution\Reports.

See Also

Reference

Graphics Support in Visual FoxPro

Other Resources

Managing Report Controls
Configuring Report Controls
Adding Report Controls
Working with Report Controls