Skip to main content
Legal Case Study

Am Law 100 Firm Uses safe-docx for Format-Preserving Document Translation

An Am Law 100 firm used safe-docx's replace_text tool to translate documents into foreign languages while preserving the original formatting and layout.

Key Results

1,000+
Tool calls in a single translation
MIT
Open-source license
Local
Execution — no data leaves the firm
author

By Steven Obiajulu

April 1, 2026

5 min read

The Challenge: Translating Documents Without Losing Formatting

When lawyers need to translate a legal document into another language, every sentence changes. A typical contract might require hundreds or thousands of individual text replacements. The challenge is not the translation itself — it is preserving the document's formatting.

Word documents store text alongside complex XML structures that control styles, numbering, headers, and layout. When documents are edited through general-purpose tools, formatting is often lost. Styles revert to defaults. Numbered lists restart. Headers shift. The translated document arrives looking nothing like the original, and someone has to spend time manually reformatting it.

For an Am Law 100 firm that needed to translate legal documents into foreign languages, this was the core problem: they needed every sentence replaced while the document's formatting and layout stayed intact.

The Solution: safe-docx replace_text

safe-docx is an open-source MCP server that provides tools for editing existing Word documents. The firm used one tool in particular: replace_text.

replace_text performs surgical text replacement within a .docx file. It replaces the specified text while preserving all surrounding formatting — bold, italic, font sizes, paragraph styles, headers, and numbering all survive the edit.

For document translation, this means:

  1. The agent reads the document with read_file
  2. For each sentence, the agent calls replace_text with the translated text
  3. The output is a .docx file that looks like the original — same formatting, same layout, different language

A single document translation can involve over 1,000 individual replace_text calls. Over months of use, the firm has run thousands of tool calls across multiple documents and sessions.

Why replace_text Works for Translation

Translation is one of the hardest editing tasks for format preservation. Unlike a simple find-and-replace, translating a sentence often changes its length, word order, and punctuation. The replacement text is completely different from the original.

Most tools handle this by rewriting the paragraph, which strips formatting. replace_text operates at the XML level — it identifies the exact text run, replaces the content, and leaves the formatting attributes untouched. Whether the original text was bold, in a specific font, or part of a numbered list, the replacement inherits the same formatting.

Local Execution

safe-docx runs locally. Documents are processed on the firm's own machines. No data is transmitted to external servers. For a firm handling confidential legal documents, this was not a feature request — it was simply how the tool works.

The Results

The firm has been using safe-docx for over three months. The workflow has been used across multiple documents in approximately half a dozen sessions, with each session involving hundreds to thousands of individual tool calls.

The key outcome: translated documents that preserve the formatting and layout of the original. Lawyers receive a .docx file that looks like it was always written in the target language, not a reformatted copy that needs manual cleanup.

What safe-docx Is and Is Not

safe-docx is a focused tool. It is worth being clear about what it does and does not do:

  • It edits existing .docx files with formatting preservation
  • It is not for generating new documents from scratch — for that, see Open Agreements
  • It is not a litigation tool — it is designed for transactional and document preparation workflows
  • All output requires attorney review before external use
  • It is free and open-source under the MIT license

Try safe-docx

safe-docx installs in one command:

claude mcp add safe-docx -- npx -y @usejunior/safe-docx

About Steven Obiajulu

Steven Obiajulu
Steven Obiajulu

Steven Obiajulu is a former Ropes & Gray attorney with deep expertise in law and technology. Harvard Law '18 and MIT '13 graduate combining technical engineering background with legal practice to build accessible AI solutions for transactional lawyers.

New York, NY UseJunior Harvard Law '18, MIT '13 • Former Ropes & Gray
Last updated: April 3, 2026

UseJunior is a tool for law firms and licensed attorneys. We do not provide legal advice.

At a Glance

Firm Type
Am Law 100
Use Case
Translate legal documents while preserving formatting
Tool
safe-docx (open-source MCP server)
Primary Tool Used
replace_text
License
MIT (free, open-source)

See Similar Results?

Send us a contract and we'll show you what UseJunior can do.

Book a Demo

Enterprise Security

SOC 2 Type II & ISO 27001:2022 certified. Your data is never used for training.

View Security Details →

Ready to See This on Your Contracts?

Send us a document and see how UseJunior handles it. No software to install — just email.