ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / RTF functions
  • Table column
  • rtfColor attribute
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Modifies or lists the attributes of the text currently selected in an RTF field (in a WINDEV window or report)..
This function can also be used on a character string containing text in RTF. In this case, it is only possible to modify the attributes of the text..
Remark: Text in a window can be selected by the user or programmed using the Cursor and CursorEnd properties.
Example
// Passe la sélection en Arial
RTFSélection(SAI_Saisie1,rtfFontName, "Arial")
// Passe la sélection police de taille 12
RTFSélection(SAI_Saisie1, rtfFontSize, 12)
// Passe la sélection en gras
RTFSélection(SAI_Saisie1, rtfBold, True)
// Modifie la couleur de la sélection
RTFSélection(SAI_Saisie1, rtfColor, RGB(134, 345, 255))
// Si la sélection contient des valeurs diverses
IF RTFSélection(SAI_Saisie1, rtfBold) = "" THEN
// On passe tout en gras
RTFSélection(SAI_Saisie1, rtfBold, True)
ELSE
// On inverse l'état
bGras is boolean = RTFSélection(SAI_Saisie1, rtfBold)
RTFSélection(SAI_Saisie1, rtfBold, NOT bGras)
END
// Passer tous les "WINDEV" d'un texte en rouge souligné
I is int
I = RTFSearch(SAI_Saisie1, "WINDEV")
WHILE I > 0
// Passage en rouge
RTFSélection(SAI_Saisie1, rtfColor, LightRed, I, 6)
// Passage en souligné
RTFSélection(SAI_Saisie1, rtfUnderlined, True, I, 6)
// Recherche du suivant "WINDEV"
I = RTFSearch(SAI_Saisie1, "WINDEV", rtfCaseSensitive, I + 1)
END
// Transformation d'un texte RTF
MonTexte is string
MonTexteRTF is string
MonTexte = "Texte sans mise en forme provenant d'une chaîne de caractères du WLangage"
MonTexteRTF = RTFSélection(MonTexte, rtfBold, True, 1, Length(MonTexte))
SAI_SaisieRTF = MonTexteRTF
Syntax

Selection in an RTF control Hide the details

<Result> = RTFSelection(<RTF control> , <Attribute> [, <New value> [, <Start> [, <Size>]]])
<Result>: Character string, integer, boolean
  • Former attribute value. The type depends on the specified attribute.
  • Empty string ("") if the selection contains different versions of the same attribute (selection in bold and non-bold for example).
<RTF control>: Control name
Name of RTF control.
<Attribute>: Constant
Attribute to retrieve or to modify:
rtfAlignmentAlignment of selected paragraphs. Possible values:
  • chLeft: left.
  • chDroite: right.
  • chCentre: in the center.
  • chJustified: justified.
rtfBackgroundColorText background color (attribute type: Integer).
rtfBoldBold characters (attribute type: Boolean).
rtfColorText color (attribute type: Integer).
rtfFontNameName of font used (attribute type: Character string).
rtfFontSizeFont size (in pixels) (attribute type: Integer).
rtfItalicItalicized characters (attribute type: Boolean).
rtfStrikethroughStrikethrough characters (attribute type: Boolean).
rtfUnderlinedUnderlined characters (attribute type: Boolean).
<New value>: Character string, integer, boolean (optional)
For a modification, new value of the specified attribute.
<Start>: Optional integer
Position of the character from which the type of the attribute must be retrieved or changed. If this parameter is not specified, the attribute of the text currently selected in the edit control is retrieved or changed.
<Size>: Optional integer
Number of characters whose type of attribute must be retrieved or modified. If this parameter is not specified, the attribute of the text currently selected in the edit control is retrieved or changed.

Selection in an RTF string Hide the details

<Result> = RTFSelection(<RTF string> , <Attribute> , <New value> , <Start> , <Size>)
<Result>: Character string
New character string where the different changes have been performed. The initial string is not modified.
<RTF string>: Character string
Character string in RTF.
<Attribute>: Constant
Attribute to modify:
rtfAlignmentAlignment of selected paragraphs. Possible values:
  • chLeft: left.
  • chDroite: right.
  • chCentre: in the center.
  • chJustified: justified.
rtfBackgroundColorText background color (attribute type: Integer).
rtfBoldBold characters (attribute type: Boolean).
rtfColorText color (attribute type: Integer).
rtfFontNameName of font used (attribute type: Character string).
rtfFontSizeFont size (in pixels) (attribute type: Integer).
rtfItalicItalicized characters (attribute type: Boolean)
rtfStrikethroughStrikethrough characters (attribute type: Boolean).
rtfUnderlinedUnderlined characters (attribute type: Boolean).
<New value>: Character string, integer, boolean
New value for the specified attribute.
<Start>: entier
Position of the character from which the attribute type is to be changed. Warning: This position does not take RTF tags into account..
<Size>: entier
Number of characters for which you want to change the attribute type.
Remarks

Table column

RTFSelection allows you to change the selection of the active cell. No other cell can be modified.
The following code triggers an error:
RTFSélection({ControlCurrent()}[TableSelect(TABLE_Table1)], rtfColor, LightGray)
The following code must be used:
RTFSélection({ControlCurrent()}, rtfColor, LightGray)

rtfColor attribute

The rtfColor attribute can return or receive the value DefaultColor: the text color then depends on the color settings defined in the Windows Control Panel.
Component: wd300obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/21/2024

Send a report | Local help