how to print formatted, non-html text

Jeanne A. E. DeVoto jeanne at runrev.com
Sat Jan 4 22:20:01 EST 2003


At 4:51 PM -0800 1/4/03, Alex Rice wrote:
>I need to print some text which is formatted in plain text with a fixed
>width font. In my field I'm viewing it in a field with a fixed with
>font (Courier).
>
>I'm attempting to print this content with revPrintText, but can't get
>it to look right. It looks OK with revPrintField, but I like the
>headers and footers offered by revPrintText
>.[...]
>If I use Courier for the font, as above, the html formatting eats up
>the whitespace, defeating my original intent. Can I trick revPrintText
>somehow?

There's a fourth parameter for revPrintText, where you can specify a field
whose text properties are used for the printout. So if you create a field
set to display Courier 9, you can use

  revPrintText myText, myHeader, myFooter, \
     the long name of field "Courier Template"


>Also, can I get auto page numbering with either revPrintText or
>revPrintField?

This is from the 2.0 docs (but works in 1.1.1):

------
If the textToPrint, headerText, or footerText contains any expressions of
the form <%expression%>, the expression is evaluated and replaced with the
value before the text is printed. For example, if the textToPrint contains
the text
	Today's date is <%the long date%>
the printed text reads
	Today's date is Friday, February 15, 2002
(assuming, of course, that the revPrintText command is executed on that date).

You can also use the special values <%pageNumber%> and <%numPages%> in the
textToPrint, headerText, or footerText. These expressions are replaced with
the current page number or total number of pages respectively.

The headerText and footerText can contain up to two tab characters:
* Everything up to the first tab character is left-aligned.
* Everything between the first and second tab characters is centered.
* Everything after the second tab character is right-aligned.
If the headerText or footerText contain more than two tab characters,
everything after the third tab is ignored.
------

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
Runtime Revolution Limited - The Solution for Software Development
http://www.runrev.com/





More information about the use-livecode mailing list