Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
WordFile.Substitute
Replaces some text in the document with new text.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
WordFile | 11.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "WordFile.Substitute"; WordFile; FindText { ; Text; All } ) More
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
WordFile | The reference number of the open word file. | $wordFile | |
FindText | The text to look for. | "$City" | |
Text | The new text. | "New York" | Optional |
All | Pass 1 to replace all occurrences with same text. | 1 | Optional |
Result
Returns OK or error.
Description
Replaces some text in the document with new text.Like WordFile.ReplaceTag function, but without markers around the tag.
Handles multi line text better for normal paragraphs. It creates for you new paragraphs for each line in the new text.
If you change font or style of the text within the find text, it will not be recognized. So please keep all text within the same font style.
Examples
Substitute a text in word file:
# load it
Set Variable [ $Wordfile ; Value: MBS( "WordFile.OpenContainer"; myTable::InputWordFile ) ]
# replace something
Set Variable [ $r ; Value: MBS( "WordFile.Substitute"; $Wordfile; $SearchWord; $ReplaceWord ]
# write it
Set Field [ myTable::OutputWordFile ; Value: MBS( "WordFile.WriteContainer"; $Wordfile; "Test.docx" ) ]
# release memory
Set Variable [ $r ; Value: MBS("WordFile.Release"; $Wordfile) ]
See also
Release notes
- Version 14.2
- Improved WordFile.ReplaceTag and WordFile.Substitute functions to remove control characters from replacement text to avoid creating broken word files.
- Version 13.4
- Fixed a problem with WordFile.ReplaceTag and WordFile.Substitute functions when passing in NULL characters in the text.
- Version 12.1
- Fixed possible crash in WordFile.Substitute function.
- Version 11.5
- Fixed an edge case for WordFile.Substitute not working correctly for text near the end of the document.
- Version 11.4
- Added WordFile.Contains and WordFile.Substitute functions.
Blog Entries
- MBS FileMaker Plugin, version 14.2pr1
- MBS FileMaker Plugin, version 13.4pr7
- MBS FileMaker Plugin, version 12.1pr1
- MBS FileMaker Plugin, version 11.5pr4
- New in MBS FileMaker Plugin 11.4
- Neues MBS FileMaker Plugin 11.4
- MBS FileMaker Plugin 11.4 - More than 6500 Functions In One Plugin
- MBS FileMaker Plugin, version 11.4pr2
FileMaker Magazin
This function checks for a license.
Created 8th August 2021, last changed 8th September 2021