User Tools

Site Tools


Text Style Tags

If the attributed option has been set in PL_SetFormat, special tags can be used in any text contained in a PrintList Pro area to print multi-styled characters.

These tags work just like HTML tags: <tag>styled text</tag>.

Style Tag
Underline<u> or <ins>
Set font size to # points<s #>
Increase font size by # quarters (1/4) of current size<s +#>
Decrease font size by # quarters (1/4) of current size<s -#>
Set font by name<f “font name”>
(needs to be quoted if the name contains more than one word)
Set color (any format can be used, e.g. <c 0xFFFF0000> <c 1.0,0,0> <c P123> <c dark orange>)<c color name>

4D internal format for styled text is stored as <SPAN STYLE=“style attributes”> where the style attributes used by PrintList Pro are:

  • font-family
  • font-size
  • font-weight (bold/normal)
  • font-style (italic/normal)
  • text-decoration (underline / line-through/none)
  • color (#RRGGBB)
  • background-color (#RRGGBB)

It is also possible to set the format as attributed, and specify the style attributes using the PL_SetFormat command.

Example for an longint column:

  $format:="<c blue>+#####</c>;<i><c red>-#####</c></i>;<s+1><c green><b>ZERO</b></c></s>"
  PL_SetFormat ($area;1;$column;0;0;1;1;1;0)
  // Right-aligned (it is a number; default of zero will use 2), auto-sized height (because ZERO is bigger),
  // attributed, with "compatible" line spacing and default vertical alignment

With the above settings:

  • Positive numbers will be printed in blue roman characters with a plus sign.
  • Negative numbers will be printed in red italic characters with a minus sign.
  • Zeros will be printed in green bold, font size increased by 25%, with the text “ZERO”.
  • Here is the result:

Note: if the number format is too “small” to hold the number, 4D (and PrintList Pro) will display it as “<<<<<<<<<<<<<<<<<<”, which will interfere with the opening tag character “<” if the column is attributed (multi-styled). In the example above (using “## ###” as a number format), this will be the case for all numbers exceeding 99,999. Make sure that the format used will not cause the number to overflow, lest unexpected results might ensue.

text_style_tags.txt · Last modified: 2017/05/22 14:00 by plp_admin