PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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 format (containing a text in RTF format).
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>: Character string (with or without quotes)
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 character string in which the different replacements have been performed. The initial string is not modified.
<RTF String>: Character string (with quotes)
Name of character string in RTF format where the replacement will be performed. This string is not modified
<String to Insert>: Character string (with quotes)
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
WINDEVWindowsUser code (UMC) The subscript of the first character in the edit control is set to 1.
Components
WINDEVReports and Queries wd230obj.dll
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment