Test cases / doc

deft doc replace

Find and replace text in Word, keeping the formatting

1 run on real files, 4 tests on generated files, not shown. 0 failed.

Real-file tasks

Real files and a plain-language job, from the agent benchmark. These are the reference answers, not an agent run.

Find and replace in WordPassed

Replace every Calibri with Georgia in letter.docx and save it as changed.docx, keeping the formatting.

deft doc replace letter.docx --find Calibri --replace Georgia -o changed.docx

Input

letter.docx 11.3 KB
Rendered by macOS Quick Look, first page

Rendered by macOS Quick Look, first page

Text inside
I am a test document
This is page 1
I am Calibri (Body) in font size 11

This is page two
It’s Arial Black in 16 point
It’s also in blue

Output

Rendered by macOS Quick Look, first page

Rendered by macOS Quick Look, first page

Text inside
I am a test document
This is page 1
I am Georgia (Body) in font size 11

This is page two
It’s Arial Black in 16 point
It’s also in blue
Automatic checks (1)
  • python: code = "import zipfile; x = zipfile.ZipFile('changed.docx').read('word/document.xml').decode(); assert 'Georgia' in x and 'I am Calibri' not in x"