Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASCII space different than character when using pad

Status
Not open for further replies.

acorbally

Programmer
Jan 9, 2001
65
US
I am manually formatting inside a memo field. Prior to inserting into the memo, I create a string of data to insert. The string is manually formatted. Below is an example:

m.svngs = m.svngs+padr(rpt.pat_id,15,' ')+chr(9)+chr(9)+padr(rpt.name,40,' ')+chr(9)+chr(9)+padr(rpt.critsel,50,' ')+chr(9)+chr(9)+padr(rpt.svngsamt,15,' ')+chr(13)

My problem is when I pad the strings. I am finding that if I was to pad the string 'test' to a lenght of 10 and then add another string of 'data' it would look something like this: 'test data'. If the next record was 'sample' and I added 'data' it would look like this: 'sample data'

When I do this, I am adding carriage returns using CHR(13), so my data would look like the following in the memo field:

'test data'
'sample data'

This looks great in this post because the spaces are taking the space of an actual space. In the memo field the space only takes up a small portion so my manual formatting is skewed. I see things like:

'test data'
'sample data'

(In the memo field the space between test
and data is in fact 10 spaces (what I padded to))
It is also 10 spaces padded between sample and data, it only looks different because there are more characters filling space in the 'sample data' example.

This is because in the memo you could use two to three spaces to fill the same space a letter 'B' would take up. This is causing irregular formatting. Any ideas on how to get around it so I can format the memo manually but appropriately?

Thanks in advance.
 
if this is just a display problem, then when you are browsing your memo field, from the foxpro menu select 'text font', and choose "courier" (for example) to display your data


Pete Bloomfield
Down Under
 
This is a display issue, but it occurs when I report the memo field in a report. I need it to be programatic.
 
if you have used the report builder to create your report, edit your report (modify report xxx), select the field, and from your foxpro menu, select 'object font' and then choose "courier" , save your report.

when your report runs, the memo field data will display correctly formatted



Pete Bloomfield
Down Under
 
Report is in courier. Does not make any changes. Any other suggestions?
 
I did find what you meant by Courier, and I found after some testing that it does work. When I changed to Courier in the memo field, it formatted it all. I did try to display the memo field in a report from the table and when I did the skewed formatting appeared again. How do I fix that? Why is it doing that? I even tried changing the font on the report to courier. I did find that the report writer only had courier new, not just courier. Could that be the problem? Know of any other fonts that would work?
 
Thanks for the link. I am still finding that reguardless of hte monospaced font, the memo field's formatting is still being altered in the report when I run it.
 
Remember that some fonts are "video" fonts and some are "printer" fonts. Unless they are a TrueType font and both the video driver and the printer driver respect the font information, they may not appear the same on the screen and the paper!

Rick
 
I am using Courier and it displays okay in the memo field, but a preview and a print alter the formatting. I have also tried a true type font such as @Batang which states it is a true type font and will print the same as preview. I don't know what else to do. I have to make this work!!!
 
hi acorbally

from what you have said, i am confused as to whether you have done what i think is required for you to see the memo field formatted the way you want in a report.

the following is what i did to get both a page preview and a paper print out of a memo field with the format you are after.

for a new report, in the command window type "create report xxx", and then select "report / page layout / font" from the foxpro menu. this will set the default font for your report, and any new objects added to the report will have that font.

for an existing report, in the command window type "modify report xxx", and then select the object (click the object) that needs to have the font changed - in your case, this will be the object that displays the memo field [smile]. then from the foxpro menu select "object / font" and change the font to "courier new". (yes, courier new works fine)

if you do a print preview (select report / page preview from the foxpro menu) you should see the memo field formatted the way you want.

let me know how you go

Pete Bloomfield
Down Under
 
CourierNew with the same pitch. CourierNew is non-proportional, true type and has the same width irrespective of the attribute (Bold, Italic ..).

End
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top