DocxFactory is a free, cross platform C/C++ library with C#, Java, Python, Progress 4GL wrappers and command line tools for generating (Microsoft Word .DOCX) files (also called Open XML).
DocxFactory Features: http://docxfactory.com
DocxFactory Tutorials (PDF): http://docxfactory.com/tutorial
Download the binaries for your operating system: http://docxfactory.com/free-download
Installation: For information on how to install DocxFactory on your operating system, see the Installation chapter included in all of the tutorials.
Read the compilation instructions
Build with Conan + CMake (macOS example):
conan profile detect --force
conan install . -of build/macos-release -s build_type=Release -o '&:with_uno=False' -o '&:with_imagemagick=False' --build=missing
cmake -S . -B build/macos-release \
-DCMAKE_TOOLCHAIN_FILE=build/macos-release/build/Release/generators/conan_toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DDOCXFACTORY_BUILD_PYTHON=ON
cmake --build build/macos-release --config Release -jLinux variant:
conan profile detect --force
conan install . -of build/linux-release -s build_type=Release -o '&:with_uno=False' -o '&:with_imagemagick=False' --build=missing
cmake -S . -B build/linux-release \
-DCMAKE_TOOLCHAIN_FILE=build/linux-release/build/Release/generators/conan_toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DDOCXFACTORY_BUILD_PYTHON=ON
cmake --build build/linux-release --config Release -jPython import/use example:
import sys
sys.path.insert(0, "build/macos-release")
sys.path.insert(0, "build/macos-release/python")
import docxfactory
compiler = docxfactory.WordProcessingCompiler.get_instance()
compiler.compile("input_template.docx", "compiled_template.dfw")
merger = docxfactory.WordProcessingMerger.get_instance()
merger.load("compiled_template.dfw")
merger.merge("<root><name>Example</name></root>")
merger.save("output.docx")
merger.close()For Linux builds, replace build/macos-release with build/linux-release in the two sys.path.insert(...) lines above.
Notes:
- Generated artifacts are
build/<cfg>/docxfactory.pyandbuild/<cfg>/python/_docxfactory.so. - The API is singleton-style and uses
get_instance(). - Snake case names are also available (
word_processing_compiler,word_processing_merger).
- In-depth Python docs: docs/python/README.md
- Hello-world executable example: examples/python/hello_world/README.md
Read the changelog
DocxFactory is copyrighted by Alon Blich and licensed under the Apache 2.0 license.
Microsoft Office and Word are registered trademarks of Microsoft Corporation.
DocxFactory only includes third party components that have a permissive free license.
Please see the third party / licenses acknowledgement.