DuckX is a library for creation of Office docx files
DuckX helps you to work with docx files quickly in C++.
- Documents (docx) [Word]
- Read/Write/Edit
Here's an example of how to use duckx to read a docx file; It opens a docx file named file.docx and goes over paragraphs and runs and prints them:
#include <iostream>
#include <duckx.hpp>
int main() {
duckx::Document doc("file.docx");
doc.open();
for (auto p = doc.paragraphs(); p.has_next() ; p.next()) {
for (auto r = p.runs(); r.has_next(); r.next()) {
std::cout << r.get_text() << std::endl;
}
}
}
Note that you must use -lduckx flag to compile your cpp file
For example:
g++ sample1.cpp -lduckx
- See other Examples
It's easy as pie!
The preferred way is to create a build folder
git clone https://github.com/amiremohamadi/DuckX.git
cd DuckX
mkdir build
cd build
cmake ..
cmake --build .
This library is available to anybody free of charge, under the terms of MIT License (see LICENSE.md).