Skip to content

hexagon-oss/DocxFactory

 
 

Repository files navigation

DocxFactory Project

Description

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.

Compiling DocxFactory and high-level language wrappers

Read the compilation instructions

Python SWIG Quick Start

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 -j

Linux 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 -j

Python 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.py and build/<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).

Python Documentation and Examples

History

Read the changelog

Author and License

DocxFactory is copyrighted by Alon Blich and licensed under the Apache 2.0 license.

Third Party / Licenses Acknowledgement

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.

About

Cross platform C/C++ library with C#, Java, Python, Progress 4GL wrappers and command line tools for generating Microsoft Word .DOCX (OpenXML) files

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C++ 66.4%
  • OpenEdge ABL 20.4%
  • SWIG 4.8%
  • C# 3.5%
  • Makefile 1.8%
  • C 1.4%
  • Other 1.7%