home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Phoenix CD 2.0
/
Phoenix_CD.cdr
/
01e
/
margin.zip
/
MARGIN.DOC
< prev
next >
Wrap
Text File
|
1987-02-13
|
2KB
|
52 lines
Last revision: February 13, 1987 at 9:39
I have always had trouble printing multi-line strings from Clipper!
From what I can guess, it appears to be a "feature" or "bug" without
a decent work-around. If you are using a formatted string with <CR>
at the end of each line, you can write to a text file then append the
text file into a DBF file with a one line field and then print the
DBF file one line at a time. I call that an indecent work-around.
So, out with my trusty knowledge of C and a new function called
MARGIN() which returns a string with the correct number of spaces
to provide the desired margin. The correct calling syntax is:
* MARGIN()
* Syntax: MARGIN( <expC>, [<expN>] )
* Return: A string containing in the contents of the
* expC string with all hi bits stripped and a margin
* width of expN. Range of expN is 0..32, default of 8
Example:
message = "A long string with many lines with <CR>,<LF> and even"+;
CHR(13)+CHR(10)+CHR(211)+CHR(232)+CHR(233)+CHR(244)+;
" some high bits set because it was read in from a WordStar"+;
CHR(13)+CHR(10)+;
"file using the MEMOREAD() function"
? MARGIN(message,5)
This will print the message with a margin of 5 spaces. Now, I didn't
actually try the above string but it should be printed on 3 lines.
If the string contains high bits from being generated using Clippers
MEMOEDIT() or say read in from a WordStar file, all high bits are
stripped in the returned string. Also, if a margin width isn't
specified, the default of 8 spaces is used.
NOTE: This has been compiled with Lattice version 3.0 and used with
Clipper Autumn 86 version. I don't think it will work with Winter 85
version since that version used Latice version 2.x. If using W85,
you might try recompiling with the older Lattice version.
Oh, one more trick, you can embed macro references to memory variables
into the strings being printed and they will be expanded when printed.
Thus, by "...&mem_var1....&mem_var2...etc" one may do a right decent
form letter with mail merge in the actual text. Neat, what say?
Enjoy, H.M. Van Tassell - Watchung, NJ