Browse documentation
DocsFormat guide

DOCX & PPTX

Extract Word and PowerPoint content and reinsert translations without installing Microsoft Office.

01

Parse or stream

The canonical wrappers accept a path, bytes, or a binary stream. Use parse for a materialized document or stream for one-pass iteration with document metadata.

office.py
import lokit
document = lokit.parse.docx(    "handbook.docx",    source_locale="en-US",    target_locale="fr-FR",)
slides = lokit.stream.pptx(    "deck.pptx",    source_locale="en-US",    target_locale="fr-FR",)
02

Reinsert translations

Office output needs the original package so Lokit can preserve its structure. The document proxy makes that requirement visible.

export_office.py
document.export.docx(    "handbook.fr.docx",    source_docx="handbook.docx",    target_locale="fr-FR",)
document.regen.docx(    "handbook.docx",    "handbook.fr.docx",    target_locale="fr-FR",)
03

Advanced Office controls

The canonical lokit.parse and lokit.write functions cover common cases. Reach for lokit.office when you need advanced import/export options, binary sinks, or the structured OfficeExportResult. Async imports are iterated; async exports are awaited.