ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / RTF functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Replaces or inserts a character string in an RTF control (found in a window or in a WINDEV report) or in a string in RTF (containing a text in RTF).
Example
// Use with an RTF edit control
n is int
sSoughtWord is string = "Developing is fantastic"
sReplaceWord is string = "Easy development!"
// Case-insensitive search starting from the end of selection
n = RTFSearch(EDT_Edit1, sSoughtWord)
// If the word was found
IF n <> 0 THEN
// Replaces the word found
RTFReplace(EDT_Edit1, sReplaceWord, n, n + Length(sSoughtWord))
END
// Use with a string
nRes is int
sString is string = EDT_Edit1
// Search for the whole RTF word
nRes = RTFSearch(sString, "RTF", rtfFullWord + rtfCaseSensitive)
WHILE nRes <> 0
// Replace the words found by "WD"
sString = RTFReplace(sString, "WD", nRes, nRes + 3)
nRes = RTFSearch(sString, "RTF", rtfFullWord + rtfCaseSensitive, nRes + 3)
END
Syntax

Replacement in an RTF control Hide the details

RTFReplace(<RTF control> , <String to insert> [, <Start> , <End>])
<RTF control>: Control name
Name of RTF control in which the replacement will be performed. The replacement will be performed in the control directly.
<String to insert>: Character string
Character string that will be inserted into the control at <Start> position.
<Start>: Optional integer
Position where <String to Insert> will be inserted into the <RTF Control>. If this parameter is not specified, the text will replace the current selection. If there is no current selection, the text will be inserted at cursor position.
IF <Start> = <End>, the text will be inserted at <Start> position.
<End>: Optional integer
Specify whether the text must be inserted or whether it must replace the existing text.
If <Start> = <End> (or if <Start> is greater than <End>), the text will be inserted at <Start> position.
If <Start> is less than <End>, the text will replace the characters found between <Start> and <End>.

Replacement in an RTF string Hide the details

<Result> = RTFReplace(<RTF string> , <String to insert> [, <Start> , <End>])
<Result>: Character string
New string in which the specified strings have been replaced. The initial string is not modified.
<RTF string>: Character string
Name of character string in RTF where the replacement will be performed. This string is not modified
<String to insert>: Character string
Character string that will be inserted into the control at <Start> position.
<Start>: Optional integer
Position where <String to Insert> will be inserted into the <RTF String>. If this parameter is not specified, the text will replace the current selection. If there is no current selection, the text will be inserted at cursor position.
IF <Start> = <End>, the text will be inserted at <Start> position.
<End>: Optional integer
Specify whether the text must be inserted or whether it must replace the existing text.
If <Start> = <End> (or if <Start> is greater than <End>), the text will be inserted at <Start> position.
If <Start> is less than <End>, the text will replace the characters found between <Start> and <End>.
Remarks
Windows The subscript of the first character in the edit control is set to 1.
Component: wd290obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 04/06/2023

Send a report | Local help