Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using TXTWIDTH() in Visual Foxpro 5.0 Reports
Message
From
04/03/1997 17:32:46
 
 
To
04/03/1997 12:30:15
Rob Gordon
Xon Digital Communications Ltd.
Dartmouth, Nova Scotia, Canada
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00022682
Message ID:
00022855
Views:
38
>>>I need a way of determining the width of text in a VFP 5.0 report. I'm generating a report FRX;FRT file on the fly and I have to determine the maximum amount of text I can put into a text box in the report. I'm currently using TXTWIDTH() and passing it the string to be printed as well as the Font information of the textbox being created. This method works OK in text boxes in forms but doesn't work when making reports.
>>>
>>>HELP !
>>>
>>>Thanks in advance ..
>>
>>As far as I know VFP Report Writer is not object-oriented, i.e. report controls don't have 'Width' property and TXTWIDTH() cannot be used here.
>
>True, However, the 'text box' control does have a physical width in which the text will be placed and wrapped around where appropriate. Foxpro obviously uses some algorithm to determine the size of the text - it has to be based on the Font being used - and this is the algorithm I need.
>
>Thanks in advance ..

Rob, what you need is to covert Pixel information to Report coordinates, right ?

To do this in VFP, multiply the top, left, width, or height by 104.17
i.e. nTxtWidthInRpt = nTextWidth * 104.17
You will have the width of the text for the FRX file.

The nTextWidth can be obtained via TXTWIDTH().
(Remember that TXTWIDTH() uses the character average width.)
Previous
Reply
Map
View

Click here to load this message in the networking platform