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
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
changed.docx 8.4 KB

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"