共用方式為


How to: Dynamically Format Report Controls

When you design a report, you can specify the display properties of report controls. Your specifications determine how your reports will print at run time. For example, you can specify color, font, and size. You can also dynamically change the properties of report controls at run time so that the control display can be different based on whether your condition evaluates to .T. or .F. each time the control is printed.

To add dynamic formatting to a field control

  1. Right-click a field control in the Report Builder and click Properties.

  2. Click the Dynamics tab.

  3. Click Add to open the Add Dynamic Style Condition Dialog Box (Report Builder).

  4. Enter a name for your condition and click OK.

    The name you enter appears in the list of conditions after you create the condition.

  5. In the Configure Dynamic Properties Dialog Box (Report Builder), specify a condition in the Apply when this condition is true box.

    The condition needs to evaluate to a logical .T. or .F. value. For example, orders.requiredate < DATE() or orderdetail.quantity > 5.

  6. If you want to replace the text with new or modified content, add the new text or expression in the Replace expression result with box.

    For example, if your field is bound to orders.requiredate and your condition expression is orders.requiredate < DATE(), you could replace the expression value with the expression DTOC(orders.requiredate) + " LATE ORDER" in the printed report.

  7. Optionally, set Font settings for the display of the text in the report.

    The Sample area at the bottom of the dialog box displays the way your text appears when your condition evaluates to .T..

  8. Optionally, set Color settings for the display of the text.

    You need to clear the Use default foreground (pen) color and Use default background (fill) color checkboxes to change the respective color settings.

  9. Optionally, set opacity and alpha settings for the text.

  10. Click Ok to return to the Dynamics tab.

    If you have multiple conditions set, you can change the order they are evaluated by dragging them to a new location in the list.

To add dynamic sizing to an object

  1. Right-click an object (for example, a rectangle or an OLE object), in the Report Builder, and click Properties.

  2. Click the Dynamics tab.

  3. Click Add to open the Add Dynamic Style Condition dialog box.

  4. Enter a name for your condition and click Ok.

    The name you enter appears in the list of conditions after you create the condition.

  5. In the Configure Dynamic Properties dialog box, specify a condition in the Apply when this condition is true box.

    The condition needs to evaluate to a logical .T. or .F. value.

  6. Specify the Height or Width of the control. Enter -1, the default, to keep the dimensions created in the Report Builder. Enter a value in units of 1/960 inches to resize your control when your condition evaluates to .T..

    For example if you set Width to 960 and Height to 960, your object prints as a 1 inch square.

  7. Click Ok to return to the Dynamics tab. If you have multiple conditions set, you can change the order they are evaluated by dragging them to a new location in the list.

See Also

Reference

Add Dynamic Style Condition Dialog Box (Report Builder)
Configure Dynamic Properties Dialog Box (Report Builder)