Word Find & Replace
Word Find & Replace
Section titled “Word Find & Replace”Type: word-find-replace · Package: Word Activities v1.0.0 · Output: int
Searches for text and replaces it throughout the document. Returns how many replacements it made. It’s the basis of the templates pattern: you take a .docx with markers ({NOMBRE}, {FECHA}) and replace them with real data to generate custom documents.
How it works
Section titled “How it works”Replaces all occurrences of find with replace. By default case insensitive (caseSensitive = false). Accepts session or path (in path mode, opens, modifies and saves automatically). Returns the number of replacements.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
find | expression | Texto a buscar. |
replace | expression | Texto de reemplazo. |
Optional parameters
Section titled “Optional parameters”| Parameter | Editor | Description |
|---|---|---|
session | session | Word Open session (instead of path). |
path | expression | Path to .docx (quick mode: open, modify and save only). |
caseSensitive | boolean | Case sensitive. By default false. |
Output
Section titled “Output”Returns a int with the number of replacements made.
Example
Section titled “Example”Fill out a letter template with multiple markers:
Copy File source = = asset("plantilla.docx") destination = = rutaCarta overwrite = trueWord Open path = = rutaCarta └─ body: Word Find & Replace find = "{NOMBRE}" replace = = cliente.nombre Word Find & Replace find = "{FECHA}" replace = = today().ToString("dd/MM/yyyy") Word Find & Replace find = "{MONTO}" replace = = toString(monto) Word SaveRelated activities
Section titled “Related activities”- Word Read Text — read the document.
- Copy File — duplicate the template before filling it out.