home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 01e / margin.zip / MARGIN.DOC < prev    next >
Text File  |  1987-02-13  |  2KB  |  52 lines

  1.       Last revision: February 13, 1987 at 9:39
  2.  
  3. I have always had trouble printing multi-line strings from Clipper!
  4. From what I can guess, it appears to be a "feature" or "bug" without
  5. a decent work-around.  If you are using a formatted string with <CR>
  6. at the end of each line, you can write to a text file then append the
  7. text file into a DBF file with a one line field and then print the
  8. DBF file one line at a time. I call that an indecent work-around.
  9.  
  10. So, out with my trusty knowledge of C and a new function called
  11. MARGIN() which returns a string with the correct number of spaces
  12. to provide the desired margin.  The correct calling syntax is:
  13.  
  14. * MARGIN()
  15. * Syntax: MARGIN( <expC>, [<expN>] )
  16. * Return: A string containing in the contents of the
  17. *         expC string with all hi bits stripped and a margin
  18. *         width of expN. Range of expN is 0..32, default of 8
  19.  
  20. Example:
  21.  
  22. message = "A long string with many lines with <CR>,<LF> and even"+;
  23.            CHR(13)+CHR(10)+CHR(211)+CHR(232)+CHR(233)+CHR(244)+;
  24.           " some high bits set because it was read in from a WordStar"+;
  25.            CHR(13)+CHR(10)+;
  26.           "file using the MEMOREAD() function"
  27.  
  28. ? MARGIN(message,5)
  29.  
  30. This will print the message with a margin of 5 spaces. Now, I didn't 
  31. actually try the above string but it should be printed on 3 lines. 
  32.  
  33. If the string contains high bits from being generated using Clippers
  34. MEMOEDIT() or say read in from a WordStar file, all high bits are
  35. stripped in the returned string.  Also, if a margin width isn't
  36. specified, the default of 8 spaces is used.
  37.  
  38. NOTE: This has been compiled with Lattice version 3.0 and used with
  39. Clipper Autumn 86 version.  I don't think it will work with Winter 85
  40. version since that version used Latice version 2.x.  If using W85,
  41. you might try recompiling with the older Lattice version.
  42.  
  43. Oh, one more trick, you can embed macro references to memory variables
  44. into the strings being printed and they will be expanded when printed.
  45. Thus, by "...&mem_var1....&mem_var2...etc" one may do a right decent
  46. form letter with mail merge in the actual text. Neat, what say?
  47.  
  48. Enjoy, H.M. Van Tassell - Watchung, NJ
  49.  
  50.  
  51.  
  52.