Dynamic formats in a VFP9 report

The object-oriented report writer is a powerful tool but it can take a lot of effort to get the best out of it. One new feature though is very easy to use. This lets you apply dynamic formatting to rows in a report.

Dynamic formatting - changing the appearance of the field being displayed so as to highlight interesting data - is something that clients often ask for and their interest has grown in recent years as they've bought colour lasers. They now routinely print their Excel charts in colour and they'd like their FoxPro reports in colour too.

Dynamic formatting in the VFP9 Report Writer We could do this in previous versions of FoxPro but it was hard work. If you wanted a field to appear in red when its value was negative then you had to create two textboxes on the report - one in red and one in black - and use Print When statements to control which of them would be visible.

Applying a dynamic format

This effect is much easier to achieve in the Visual FoxPro 9 Report Writer:

  • Double-click on the textbox to open the Field Properties Window.
  • Select the Dynamics tab.
  • Click Add to add a new text formatting rule.
  • Give the rule a suitable name and the Configure Dynamic Properties dialog will open as shown in the screen shot opposite.
  • Set the format you'd like to see when this rule evaluates as true. In this example I've asked for blue text on an opaque cyan background.
  • Click OK to close this dialog and again to close the Field Properties dialog.

Printout

The preview below shows how "Around the Horn", the only UK-based supplier in this extract, has been displayed in blue against a cyan background. Note that only the one field has been affected. You have to repeat the formatting for the other two textboxes to highlight the entire line.

Dynamic formatting in the VFP9 Report Writer

Related Items

Alvechurch Data - Microsoft FoxPro and Access Database Development and Training

Alvechurch Data are based close to Birmingham and provide Microsoft Access and Visual FoxPro training, development and support.

Read More

Autocomplete in Visual Fox Pro

Autocomplete in Visual Fox Pro

The textbox class in Visual FoxPro 9 has a new Autocomplete property which shows the user the previous values that have been entered in that textbox.

Read More

Access and Visual FoxPro Training

Microsoft Access and Visual FoxPro training courses and workshops offered by Alvechurch Data in Birmingham.

Read More

Geoff Franklin CV

Geoff Franklin - resume of education and experience in Access and Visual FoxPro programming.

Read More

Visual FoxPro Frequently Asked Questions

Frequently asked questions for Visual FoxPro

Read More