WordFindAndReplace

Description

This activity finds all occurrences of some word in a Word document and replaces them with other specified words.


Input

InputFile InArgument<IFileValue> REQUIRED

The word file where to perform 'Find and Replace' operations.

Values InArgument<Dictionary<String,String>> REQUIRED

The words to be replaced (Keys) in the file with their new values (Values).


Output

ReplacementCount OutArgument<Int32>

The number of replaced words.

ResultFile OutArgument<IFileValue>

The result file with replaced words.


Search Options

CaseSensitive InArgument<Boolean>

Default: false. If it is set to true the word search will be case sensitive.

ThrowIfNotFound InArgument<Boolean>

Default: false. If it is set to true DocsMarshal will throw an exception if he don't find a word in the Word document. Otherwise, if it is set to false, DocsMarshal will ignore not found words.

WholeWord InArgument<Boolean>

Default: false. If it is set to true DocsMarshal will match only entire words, not text that is part of a larger word.

Examples:
Values Results
  • 'Text to search' = 'good'
  • 'Text1' = 'I feel good'
  • 'Text2' = 'I said goodbye'
  • 'WholeWord' = True
It match only with 'Text1' because 'good' is a stand alone word.
'Text2' instead does not match because 'good' is a part of 'goodbye'.
  • 'Text1': 'I feel good'
  • 'Text2': 'I said goodbye'
  • 'Text to search' = 'good'
  • 'Text1' = 'I feel good'
  • 'Text2' = 'I said goodbye'
  • 'WholeWord' = False
It match both 'Text1' and 'Text2' because if 'whole word' is set to False also pieces of larger words are matched.
  • 'Text1': 'I feel good'
  • 'Text2': 'I said goodbye'