SAP Help Home SAP Intelligent RPA Help Portal SAP Intelligent RPA Community

Module - Content

Collection of functions related to MS Word content such as search text, insert text, replace...

Activities

Replace All (Word)

Replace all occurrences of a string in an active Word document with another string. For Example, replace all occurrences of the string "Hi World" with "Hello World" in an active document.


Technical Name Type Minimal Agent Version
replaceAll synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
oldString string mandatory The existing string that you want to replace.
newString string mandatory The new string to replace existing ones.
advancedSearchParameters irpa_word.dataObjectAdvancedSearchParameters optional Advanced option to customize the replacement. Use the enumeration enum.$.enums.WdReplace to fill the "replacementType” advanced parameter.

Output Parameters:

Name Type Description
matchFound boolean True if no match found, false otherwise.

Sample Code:

irpa_word.content.replaceAll(oldString, newString, {"matchCase" : true, "matchWholeWord" : true});

Errors:

Error Class Package Description
SequenceError irpa_core The Word Application and the current document must be defined
InvalidArgument irpa_core No text to find specified


Find Text (Word)

Finds a string representing the text or word to find in an active Word document. For Example, find all occurrences of the string "Hello World" in an active document.


Technical Name Type Minimal Agent Version
findText synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
textToFind string mandatory The existing string that you want to find.
advancedSearchParameters irpa_word.dataObjectAdvancedSearchParameters optional Optional. Advanced option to customize the search.

Output Parameters:

Name Type Description
textFound boolean True if the string is found, false otherwise.

Sample Code:

irpa_word.content.findText("textToFind", {"matchCase" : true, "matchWholeWord" : true});

Errors:

Error Class Package Description
SequenceError irpa_core The Word Application and the current document must be defined
InvalidArgument irpa_core No text to find specified


Find Next (Word)

Find the next string representing the text or word to find in an active Word document.


Technical Name Type Minimal Agent Version
findNext synchronous WIN-2.0.0

Output Parameters:

Name Type Description
textFound boolean True if the string is found, false otherwise.

Sample Code:

irpa_word.content.findNext();

Errors:

Error Class Package Description
SequenceError irpa_core The Word Application and the current document must be defined


Insert Text (Word)

Insert a string in an active Word document.


Technical Name Type Minimal Agent Version
insertText synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
textToInsert string mandatory The text to insert.

Sample Code:

var result = irpa_word.content.insertText( 'text insert' );

Errors:

Error Class Package Description
SequenceError irpa_core The Word Application and the current document must be defined