Generate condominium declaration documents in DOCX and PDF format from a Word template.
This tool replaces placeholders in a .docx file, preserves the original formatting as much as possible, and can optionally export the result to PDF with metadata.
- Generate
.docxfiles from a Word template - Generate
.pdffiles from the generated.docx - Add PDF metadata
- Fill placeholders automatically
- Convert dates to Portuguese text
- Convert money values to Portuguese text
- Generate output filenames in the format:
YYYY-MM-DD - 1AP2.docxYYYY-MM-DD - 1AP2.pdf
Managing condominium administration often requires generating formal declaration documents for property transactions.
This tool automates the generation of these documents from a Word template, reducing manual work and ensuring consistent formatting.
condominium-declaration-generator/
├─ main.py
├─ README.md
├─ requirements.txt
├─ config.example.json
├─ config.json <-- local file, not committed
├─ template.docx <-- not included in the repository
├─ src/
│ ├─ config_loader.py
│ ├─ date_utils.py
│ ├─ docx_generator.py
│ ├─ file_utils.py
│ ├─ fraction_utils.py
│ ├─ money_utils.py
│ └─ pdf_utils.py
└─ output/
git clone https://github.com/cunhabarbosa/condominium-declaration-generator
cd condominium-declaration-generator
pip install -r requirements.txt
cp config.example.json config.json
python main.pyNote:
- Adjust the configuration in
config.jsonif needed. - Make sure
template.docxcontains the required placeholders
The template file must contain the following placeholders:
{{DATA_EXTENSO}}
{{DATA_CURTA}}
{{FRACAO}}
{{ANDAR}}
{{APART}}
{{DATA_LIQUIDACAO}}
{{VALOR_ANUAL}}
{{VALOR_ANUAL_EXTENSO}}
{{VALOR_MENSAL}}
{{VALOR_MENSAL_EXTENSO}}
This project is licensed under the MIT License. See the LICENSE file for details.
Created by Antonio Barbosa