GET_SUBTEXT_FROM_LPLEN$
|
Syntax: |
GET_SUBTEXT_FROM_LPLEN$ (<Text>,<Maximum Length>,<Font Style>, <Font Height in TWIPS>[,<Font Width in TWIPS>])
|
||||||||||
|
|
|
||||||||||
|
Meaning: |
Returns a substring from <Text> which
has the maximum length <Maximum Length> when printed. This function only has an effect with ENABLE LPGDI. To compute the substring the function LPLEN
is used. Starting with the first character of
<Text> the maximum number of characters is returned whose print length
is <= <Maximum Length>. GET_SUBSTRING_FROM_LPLEN$ returns a substring of <Text> whose length
is not greater than <Maximum Length> if <Text> is printed with the font style <Font Style>,
with the height <Font Height in TWIPS> and the width <Font Width in
TWIPS>. The current font defined with LPFONTNAME
applies. With DISABLE LPGDI LPLEN returns the whole
<Text>. |
||||||||||
|
Parameter: |
|
||||||||||
|
Sample: |
/* Print
justified in report /* TEXT$
can be as long as required and may contain linefeeds. /* Printing
starts at the current position in the report. /* LINES contains the number of the last printed line, /* EBUS_REPCOLUMN
contains the columns position of the report field with /* which
this macro is executed. The width of the justified text is /* 63
columns. FONT_HEIGHT%
= GET_LPFONTHEIGHT * 20 // font
height in TWIPs of report WHILE TEXT$ <>
"" DO I% = INSTR(TEXT$,CHR$(10)) IF I% > 0 /* Linefeed THEN H_TEXT$ = LEFT$(TEXT$,I%-1) ELSE H_TEXT$ = TEXT$ ENDIF H$ = GET_SUBTEXT_FROM_LPLEN$(H_TEXT$,63,0,FONT_HEIGHT%) IF H$ = H_TEXT$ THEN /* Do not print justified because this is the
last line of a /*
paragraph REPLINE "" /* to increase the line
counter of the report LPGRIDCURSOR(LINES,EBUS_REPCOLUMN) LPRINT H$ IF I% > 0 THEN LSTRIP(TEXT$,I%) ELSE LSTRIP(TEXT$,LEN(H$)) ENDIF ELSE H1$ = H$ X$
= RIGHT$(H$,1) /*
go back to the next separator . , - or Blank
WHILE H$ <> "" AND X$ <> " " AND X$ <> "," AND X$
<> "." AND X$ <>
"-" DO RSTRIP(H$,1)
X$ = RIGHT$(H$,1) ENDDO IF H$ = "" /* no separator found THEN H$ = H1$ ENDIF LSTRIP(TEXT$,LEN(H$)) NOBLANK$(0,H$) NOBLANK$(1,H$) REPLINE "" /* to increase the line
counter of the report LPGRIDCURSOR(LINES,EBUS_REPCOLUMN) LPRINT_JUSTIFIED(H$,63) /* justified ENDIF ENDDO |
||||||||||
|
See also: |
|