Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.5   7.0   7.1   7.2   7.3   7.4   7.5   8.0   8.1   8.2    Statistic  

RichText.ReplaceText

Replaces text in current rich text document with new text.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
RichText 4.4 Yes No Yes, macOS only No No

MBS( "RichText.ReplaceText"; SearchText; NewText { ; Multiple } )

Parameters

Parameter Description Example value
SearchText The text to search. Search is case insensitive. "$FirstName"
NewText The new text to use as replacement. Can be empty. "Christian"
Multiple Optional
Optional, Pass 1 to replace all occurrences. Default is 0 to replace the first one found.
0

Result

Returns Count or error.

Description

Replaces text in current rich text document with new text.
This can be used to load Word file (DOC, RTF, DOCX), replace place holders with values for client and save a personalized copy.
Version 6.0 and newer returns number of replaces. Older versions just returned OK on success.

Examples

Replace choclate with vanilla:

Set Variable [ $r ; Value: MBS( "RichText.ReadHTML"; "<html><body><p><b>Schokoladenplätzchen</b></p></body></html>" ) ]
Set Variable [ $r ; Value: MBS("RichText.ReplaceText"; "Schokoladen"; "Vanille") ]
Show Custom Dialog [ "HTML" ; MBS( "RichText.HTMLText" ) ]

See also

Example Databases


RichText.Release   -   RichText.ReplaceTexts

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins