Skip to content
VibeQL
Blog

How to translate a Word document and keep the formatting

Why copy and paste loses the formatting of a Word file, how VibeQL translates a DOCX file in place, and what to check in the translated document.

· 7 min read

To translate a Word document and keep the formatting, translate the DOCX file itself, not text that you copy out of it. The tool must translate each paragraph as a whole, keep bold, italic, links and colours on the right words, and leave styles, tables and images untouched. VibeQL does this: you upload a .docx file and download a .docx file in the target language, with the same layout.

This post explains why Word formatting breaks in translation, what VibeQL changes in a DOCX file and what it leaves alone, and what to check before you send the translated file.

Why does formatting break when you translate a Word document?

Word stores a paragraph as a list of runs. A run is a piece of text with one format. A sentence with one bold word has at least three runs: the text before it, the bold word, and the text after it. Word also splits runs for reasons you cannot see, such as spell-check marks or an edit made on another day.

That causes two common failures:

  • Copy and paste. You copy the text into a translator and paste the result back. The bold words, links and colours are gone, and you redo them by hand.
  • Run by run. A tool translates each run on its own. The formatting stays, but the grammar breaks, because a sentence cut into pieces cannot be translated well. Word order changes between languages, so the bold word must be able to move.

There is also the rest of the file. A report has headers, footers, footnotes, tables, text boxes and comments. Many tools translate only the main body and skip the rest.

How VibeQL translates a DOCX file

A DOCX file is a zip archive of XML files. VibeQL opens it, rewrites the text of each paragraph, and keeps all other XML as it was. Styles, page setup, sections, numbering, images and their positions do not change.

One paragraph is one segment

VibeQL translates each paragraph as one piece of text, so the translation sees full sentences. Inside the paragraph, the most common format is the base. Every other format, such as a bold term, an italic title or a link, gets a small tag around it:

Send the signed form to <g1>Human Resources</g1> before <g2>31 March</g2>.

The translation must return the same tags, around the words with the same meaning. After translation, VibeQL rebuilds the runs from the tags. Each tagged span gets the exact run format of the original span: font, size, colour, highlight, bold, italic, underline.

Tabs, line breaks, images inside a line, footnote marks and fields are kept as objects in the text, so they stay in the paragraph.

We check every segment. If a tag is missing or broken, VibeQL translates that paragraph again on its own. If it still fails, it uses a plain translation in the paragraph’s base format for that one paragraph. A broken tag never reaches the document.

Which parts of the file are translated?

Part Translated
Body text, headings, lists Yes
Tables Yes, each cell. The table structure and widths stay.
Headers and footers Yes, for every section
Footnotes and endnotes Yes
Comments Yes
Text boxes and shapes Yes
SmartArt diagrams Yes
Charts Titles, series names and category labels
Content controls and hyperlinks Yes. The control and the link target stay.
Field codes, such as a table of contents The code stays. The text Word shows is translated.
Equations Kept as they are
Text with no letters, such as page numbers Kept as it is

What happens to tracked changes?

VibeQL handles tracked changes this way:

  • Inserted text is translated and stays marked as an insertion.
  • Deleted text is not translated. It stays in the original language, marked as a deletion.
  • Moved text is translated where it was moved to. The text at the old place stays as it was.

So if you accept all changes after translation, you get a clean translated document. If you reject them, the deleted text comes back in the original language. For the cleanest result, accept or reject all changes before you translate.

Text reflows, it does not shrink

Word moves text to the next line and the next page by itself. So VibeQL does not shrink text in a Word document. A longer translation makes the document longer. This is different from slides, where each box has a fixed size. How to translate a PowerPoint presentation and keep the layout explains how VibeQL fits text on slides.

What we measured

Our test set has 20 hard files, including Microsoft Word templates with designed layouts. We translate the set from English to Brazilian Portuguese and check every output. Across the set, there were 0 broken tags and under 2% English left. The English that stayed was names.

How to translate a DOCX file in the web app

  1. Open the app and choose Files.
  2. In Translate from, keep Detect language or pick the source language.
  3. In Translate into, pick the target language.
  4. Drag the .docx file onto the page, or select Choose a file.
  5. Select Translate into with your language.
  6. When you see Your translation is ready, select Download.

The file is available for 24 hours. The Word translator page has more about DOCX files.

How to translate a DOCX file with the API

The API uses the same requests as the DeepL API, so the official DeepL client libraries work when you change the server URL.

# Upload. The response has a document_id and a document_key.
curl https://vibeql.com/v2/document \
  -H "Authorization: DeepL-Auth-Key $VIBEQL_API_KEY" \
  -F "file=@report.docx" \
  -F "target_lang=DE"

# Check the status until it is "done".
curl https://vibeql.com/v2/document/DOCUMENT_ID \
  -H "Authorization: DeepL-Auth-Key $VIBEQL_API_KEY" \
  -d "document_key=DOCUMENT_KEY"

# Download the translated file.
curl https://vibeql.com/v2/document/DOCUMENT_ID/result \
  -H "Authorization: DeepL-Auth-Key $VIBEQL_API_KEY" \
  -d "document_key=DOCUMENT_KEY" \
  -o report.de.docx
# pip install deepl
import os
import deepl

client = deepl.DeepLClient(os.environ["VIBEQL_API_KEY"], server_url="https://vibeql.com")
client.translate_document_from_filepath("report.docx", "report.de.docx", target_lang="DE")
// npm install deepl-node
import * as deepl from "deepl-node";

const client = new deepl.DeepLClient(process.env.VIBEQL_API_KEY, { serverUrl: "https://vibeql.com" });
await client.translateDocument("report.docx", "report.de.docx", null, "de");

The quickstart shows how to get an API key. How a document translation API works covers polling, billing and errors in more detail. Already on DeepL? Migrate from the DeepL API by changing one line.

What to check in the translated document

  • Length and page breaks. A longer translation pushes text down. Check manual page breaks, and headings that now sit at the bottom of a page.
  • Tables with fixed widths. Cells keep their width, so long words wrap to more lines. Check narrow columns.
  • Headers and footers. A long footer line can wrap to a second line.
  • The table of contents. The entries are translated, but page numbers can change because the text is longer. Right-click the table and select Update Field, then Update entire table.
  • Spell check language. Word can still mark the text with the source language, so it shows spelling errors on correct words. Select all text, then go to Review, Language, Set Proofing Language and pick the target language.
  • Tracked changes. Deleted text stays in the original language. Accept or reject the changes.
  • Charts. The labels you see are translated. The data sheet inside the chart is not, so Edit Data in Word can bring back the original labels.
  • Images. Text inside pictures and screenshots stays in the original language.

What VibeQL cannot do yet

  • WordArt and embedded OLE objects are not translated. An embedded spreadsheet keeps its original text.
  • Text inside images is not translated.
  • No glossaries and no formality setting yet. If you need fixed terms, check them in the result.

If you only have a PDF of the document, you can still translate it. See the PDF translator and how we keep the layout when we translate a PDF. If you have the DOCX, upload the DOCX: real paragraphs reflow better than a PDF page.

How much does it cost?

VibeQL counts the characters of the source text, the same for text and documents. There is no minimum charge per document, so a one-page letter costs one page of characters. To compare with other services, use the translation cost calculator or read the translation API cost benchmark. Plans and file limits are on the pricing page.

Try it

VibeQL is in beta and sign-up is closed. Join the waitlist to get an account. The file size and page limits for each plan are in limits and errors.

Translate your next file with VibeQL

Free plan: 3 documents and 500,000 API characters a month. Sign-up opens soon; join the list and we email you.

Free plan when your account opens. One email when it is ready, then about one product email a month.

See pricing