Replace Activity
The Replace activity enables users to locate and substitute specific text within an opened Word document. It facilitates precise content modification by defining an old pattern to be replaced and a new pattern to insert.
| Field | Description | Requirement |
|---|---|---|
| Word name | The reference name of the Word file which has already been opened or created. | Required |
| Old pattern | The text pattern that will be replaced within the document. | Required |
| New pattern | The new text that will replace the old pattern. | Required |
| New line position | Specifies whether to add a new line before, after, or both before and after the replaced text. | Optional |
Action Types & Examples
Word name
- Format: String (reference name)
- Example Result:
myDocumentHandle
Old pattern
- Format: String (text or pattern)
- Example Result:
create
New pattern
- Format: String (replacement text)
- Example Result:
new
New line position
- Format: String (enum:
None,Before,After,Before_And_After) - Example Result:
Before_And_After
Implementation Examples
Field Setup - Word name: myReportDoc - Old pattern: Confidential - New pattern: Public - New line position: None
Execution Parameters - Word name: ${documentVariable} - Old pattern: $PLACEHOLDER$ - New pattern: Actual Content - New line position: Before_And_After
Technical Notes
The activity performs a case-sensitive replacement by default. Ensure the target Word document is accessible and not locked by other processes to prevent execution errors. Complex patterns or regular expressions in 'Old pattern' may require specific syntax depending on the underlying Word API's capabilities.