docx

A simple docx reader.

Pure Nim score 30/100 · tests present · docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Tags

Installation

nimble install docx
choosenim install docx
git clone https://github.com/ringabout/docx

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
docx - - - - - - -

Source

Repository https://github.com/ringabout/docx
Homepage https://github.com/ringabout/docx
Documentation View Documentation
Registry Source nimble_official

README

docx nimble

A dead simple docx reader.

Read pure text from docx written by Nim.

Usage

Keep only newline information.

import docx


echo parseDocument("test.docx")
for line in docLines("test.docx"):
  echo line

Output:

长记曾携手处,千树压、西湖寒碧。
I strove with none.
For none was worth my strife;
Nature I lov’d,
And next to Nature, Art;
I warm’d both hands before the fire of life;
It sinks,
and I am ready to depart.
仰天大笑出门去,我辈岂是蓬蒿人。

Only parse pure text.

import docx


echo parsePureText("test.docx")

Output:

长记曾携手处,千树压、西湖寒碧。I strove with none.For none was worth my strife;Nature I lov’d,And next to Nature, Art;I warm’d both hands before the fire of life;It sinks,and I am ready to depart.仰天大笑出门去,我辈岂是蓬蒿人。

Extract Picture from docx

let tmpDir = getTempDir()
if existsDir(tmpDir / "generate"):
  removeDir(tmpDir / "generate")
extractPicture("tests/test_pic.docx", tmpDir / "generate")
assert existsFile(tmpDir / "generate/image1.jpeg")