Aug 22, 2007 Download Visual FoxPro 6.0 Setup Wizard for Windows to get updated Visual FoxPro 6.0 Setup Wizard files. Visual FoxPro 6.0 Setup Wizard has had 0 updates within the past 6 months. Download Visual FoxPro 6.0 Setup Wizard for Windows to get updated Visual FoxPro 6.0 Setup Wizard files. Visual FoxPro 6.0 Setup Wizard has had 0 updates within the past 6 months.
-->Visual Foxpro 9
This article introduces how to programmatically modify a report file to change the font color of a field.
![Foxpro Foxpro](/uploads/1/1/8/6/118605508/134792604.jpg)
Original product version: Visual FoxPro
Original KB number: 188403
Original KB number: 188403
Visual Foxpro 9.0 Download Free
Summary
It may be desirable to change report fields programmatically to differentiate values or to otherwise modify the format depending on a condition. This article demonstrates how to change the font color of a report field based upon the sales totals of an individual salesperson. While this technique works in Microsoft Visual FoxPro 9.0 Professional Edition, you can obtain the same results by using Report Listener and event-driven printing.
More information
Visual Foxpro
The following creates a table, populates the table and runs a sales report, changing the font color to reflect sales totals. To change the color of a report field, the PenRed, PenGreen, and PenBlue fields of the report field's record are modified. This method could be used to also change the font style, font size or even to reposition the field. In addition, an entire class of objects could be changed, using REPLACE ALL <property field> WITH <property value> FOR objtype = 8, for instance.
Visual Foxpro Odbc Driver
- Save the following code in a program file named Maketabs.prg and run the program to create and populate a table.Sample Code
- Create a report. In the Page Header band, add a report field and make the expression salestot.id. In the Detail band, add a report field and make the expression salestot.invamt. In the Page Footer band, add a report field and make the expression salestot.invamt. Click the Calculations button in the Report Expression dialog box. Select Sum, click OK, and then click OK again. Save the report as Sales.frx.
- Save the following code in a program file named Sales.prg and run the program:
- As each report is previewed, scroll to the bottom to see the summary and observe how the color changes for each salesperson.