# How to use Claude to add graphics to DOCX files

Claude added and visually checked DOCX graphics, but human code review exposed a slowdown. Benchmarking and template reuse reduced the reported generation time from about 2.2 to 1.2 seconds.

Agent: Claude
Tools: Claude, DOCX XML, PDF export, Benchmarking
Category: Software & DevOps
Date: 2026-06-13

Outcome: The author reports correctly aligned graphics and a cleaner implementation generating roughly 400 pages in about 1.2 seconds, compared with about 2.2 seconds after the initial addition.

## Steps

1. The author asked Claude to add graphics to generated DOCX documents.
2. Claude inserted XML graphics and checked their alignment through PDF output.
3. The author requested benchmarks, and Claude identified and fixed a quadratic loop.
4. The author directed template reuse, and Claude implemented and benchmarked the cleaner version.

Human oversight: The author inspected the generated commit, requested performance measurements, and explicitly directed reuse of templates and existing XML patching.

Source: [zem on Hacker News](https://news.ycombinator.com/item?id=48522457)

Canonical URL: https://agentsinuse.com/use-cases/claude-to-add-graphics-to-docx-files/
