AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Controles, páginas y ventanas / Funciones RTF
  • Table column
  • rtfColor attribute
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
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 text attributes.
Note In a window, text can be selected by the user or programmed using the Cursor and CursorEnd properties.
Ejemplo
// Switches the selection to Arial
RTFSelection(EDT_Edit1, rtfFontName, "Arial")
// Switches the size of the font to 12
RTFSelection(EDT_Edit1, rtfFontSize, 12)
// Makes the selection bold
RTFSelection(EDT_Edit1, rtfBold, True)
// Modifies the color of the selection
RTFSelection(EDT_Edit1, rtfColor, RGB(134, 345, 255))
// If the selection contains different values
IF RTFSelection(EDT_Edit1, rtfBold) = "" THEN
	// Switch everything to bold
	RTFSelection(EDT_Edit1, rtfBold, True)
ELSE
	// Reverse the status
	bBold is boolean = RTFSelection(EDT_Edit1, rtfBold)
	RTFSelection(EDT_Edit1, rtfBold, NOT bBold)
END
// Switch all the occurrences of "WINDEV" to red and underlined
I is int
I = RTFSearch(EDT_Edit1, "WINDEV")
WHILE I > 0
	// Switch to red
	RTFSelection(EDT_Edit1, rtfColor, LightRed, I, 6)
	// Switch to underlined
	RTFSelection(EDT_Edit1, rtfUnderlined, True, I, 6)
	// Find the next occurrence of "WINDEV"
	I = RTFSearch(EDT_Edit1, "WINDEV", rtfCaseSensitive, I + 1)
END
// Transform an RTF text
MyText is string
MyRTFText is string
MyText = "Unformatted text coming from a WLanguage character string"
MyRTFText = RTFSelection(MyText, rtfBold, True, 1, Length(MyText))
EDT_RTFInput = MyRTFText
Sintaxis

Selection in an RTF control Ocultar los detalles

<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 the 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 Ocultar los detalles

<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
RTF string.
<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.
Observaciones

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:
RTFSelection({ControlCurrent()}[TableSelect(TABLE_Table1)], rtfColor, LightGray)
The following code must be used:
RTFSelection({ControlCurrent()}, rtfColor, LightGray)

rtfColor attribute

The rtfColor attribute can return or receive the value DefaultColor in which case the text color depends on the color settings defined in the Windows Control Panel.
Componente: wd300obj.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 28/03/2025

Señalar un error o enviar una sugerencia | Ayuda local