how to print on the same page concatenated fields with different text properties

Jeanne A. E. DeVoto jeanne at runrev.com
Sun Jun 2 02:03:01 EDT 2002


At 3:48 AM -0700 6/1/2002, alain GIRAUD wrote:
>I don't want to use the Print Card command because I don't need
>all the  fields of the card and besides, first, I want to insert
>subtitles between the  printed fields and, secondly, I want to
>get that fields are differently  formatted and the same with
>subtitles. (for example first field arial 12 bold,  first subtitle
>arial 10 bold, second field arial 10 plain, second subtitle arial
>10 underline and so on &)

Here are two approaches:

1. Put all text in a single field for printing, and style the text
according to your preferences first, then use the revPrintField command to
print the field. For example, your script might have something like this:

  put field "Title" & return & field "Subtitle" & return \
     & field "Text" into field "Printing" -- field is Arial 10
  set the textSize of line 1 of field "Printing" to 12
  set the textStyle of line 1 of field "Printing" to "bold"
  set the textStyle of line 2 of field "Printing" to "bold"
  revPrintField the ID of field "Printing"

In this way, you set the styles, fonts, and sizes of various parts of the
field (individual lines, words, or characters). Then when you print, the
text in the field will reflect these style choices.

2. Style the various parts of the data with HTML and use the revPrintText
command to print the HTML. Here is a simple example:

  put "<p><font face="Arial" size=12><b>" & field "Title" \
     & "</b></font></p>" into myVariable
  put "<p><font face="Arial" size=10><b>" & field "Subtitle" \
     & "</b></font></p>" after myVariable
  put "<p><font face="Arial" size=10>" & field "Text" \
     & "</font></p>" after myVariable
  revPrintText myVariable

--
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