Knowledge Base

How to change the Report Designer ruler measurement

Article ID: 186920

Article Last Modified on 2/12/2007


APPLIES TO


This article was previously published under Q186920

SUMMARY

It may be necessary to change the measurement unit of the ruler in the Report Designer. For instance, the Report Form Wizard in Visual FoxPro for Windows defaults to inches even if Measurement System in the Regional Settings Properties is set to Metric. Applications that allow users to modify reports could use this functionality, allowing the user to choose between a Metric ruler and a U. S. ruler.

MORE INFORMATION

According to the 50frx1.frx report form in the HOME() + "FILESPEC" directory of Visual FoxPro 5.0 (Visual FoxPro 3.0x has the file 30frx1.frx, and Visual FoxPro 6.0 and later versions have the file 60frx1.frx), the Ruler field of a .frx report file "specifies 1 if the ruler is displayed". When the report is created, the value of the Ruler field could actually be one of three values. The list below shows the three values and the measurement system to which each value corresponds:

1 = U. S. (inches)
2 = Metric
3 = Pixels

The following sample code shows how to programmatically change the value of this field and consequentially change the ruler measurement.

Sample Code

   *-- Code begins here
   lsRptFile = GETFILE("FRX", "Report file to open:", "Open", 0)
   IF LEN(ALLTRIM(lsRptFile)) = 0
       RETURN
   ENDIF
   USE(lsRptFile)
   LOCATE FOR objtype = 1 && Find the record for the report form object.
   IF FOUND()
      REPLACE ruler WITH 2 && Use the metric ruler.
   ELSE
      MESSAGEBOX("Not a valid report file.", 0, "Error")
      USE
      RETURN
   ENDIF
   USE

   *-- View the report to see the changes.
   MODIFY REPORT (lsRptFile)
   *-- Code ends here
				
NOTE: In FoxPro 2.x for MS-DOS and Unix, the system menu disappears when you modify the report in the program. Once you close the Report Designer and the program exits, the system menu returns.

In Visaul FoxPro 9.0, you can change the report's measurement unit by choosing Properties from the Report menu pad and then clicking the Ruler/Grid tab.

REFERENCES


Additional query words: kbDSupport kdDSE kbnokeyword

Keywords: kbhowto KB186920