replace_paragraph_text
Replace a paragraph's full text while keeping its style and formatting. Use an expected substring to confirm the correct paragraph, avoiding errors after insert/delete shifts.
Instructions
Replace one paragraph's full text, keeping style and base formatting. IMPORTANT: paragraph indices SHIFT after insert/delete operations - pass expect (a substring the target paragraph currently contains) to refuse instead of silently hitting the wrong paragraph, and verify the returned replaced_text (the old text) matches what you meant to replace. For text-anchored replacement immune to index shifts, use search_and_replace; this tool is the natural fallback when a find string would exceed live search_and_replace's length limit (no limit here). Auto-backup in file mode: prev/anchor slots in .ks4w-backups (backup=False skips rotation only); atomic validated save. Documents open in Word are edited live. Live edits leave the paragraph mark untouched (style and section breaks survive); paragraphs carrying tracked revisions are refused live - accept/reject first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| live | No | auto | |
| index | Yes | ||
| backup | No | ||
| expect | No | ||
| new_text | Yes | ||
| file_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||