Please enable JavaScript to view this site.

 

str = FormatText(sTextIn, sFormat, n32bitColor)

 

This macro function return sTextIn with markers that identify it as text that will be formatted using the format string sFormat, at a later stage, during diary generation.

 

This is an advanced function and error checking is minimal.

 

The parameters and the specifics of the return value of this function are discussed in the sections below.

 

sTextIn

 

This can be any text, even text that is the result of a previous call to the function FormatText (see the section on result, below, for more details). That is to say, formatting can be nested.

 

Note that if you are supplying a blank value for sTextIn, then the macro interpreter will ignore any formatting included in sFormat and emit message 188270. While this behavior makes sense for text formatting, it can cause paragraph-only or textbox-only formatting to be optimized away.

 

To avoid this issue, when using the FormatText function, always check if you are supplying a blank sTextIn parameter, and if so, replace it with a nil special character token, as shown in the example below.

if sText == ''
   sText = '&x'
endif
sResult = FormatText(sText'STYCELL(Sundays)', -1)

sFormat

 

Each specifier (see list in table below) is separated from the next by a comma (no space). Any value which can be specified in decimal form must use a period as decimal separator, regardless of the workstation's Windows settings.

 

A sample sFormat would be:

'B+,I+,f Times New Roman, COLOR(Pantone 231U)'

The list of the various formats supported by this function is described here.

 

n32bitColor (deprecated)

 

We recommend that you always set the value of the parameter n32bitColor to -1 and instead use the COLOR attribute within the sFormat parameter.

 

The use of the parameter n32bitColor is limited to older versions of QuarkXPress and is strongly discouraged (see the link below for more details). more details

 

result

 

The text result of this function will not be formatted text, but rather, plain text with markers that identify it for later processing.

sDate = FormatText('New Year''B+,I+,f Times New Roman', -1)

For example, the result of the above call to the function FormatText would be:

'**RICH1**New Year**TEXT1**'

At the same time a command is saved for later processing, to replace the string '**RICH1**New Year**TEXT1**' with 'New Year' in the formatting specified above.

 

If you need to get the plain text, without the markers, you can use the PeekTokenValue function.

 

See also: FormatParagraph, native text formatting.

 


Topic 177845, last updated on 18-Feb-2026