Using .DOCX Templates to Automate Contracts: How We Built Contractize with .NET, Angular, and Formize API

Bogdan PiluginBogdan Pilugin
3 min read

When building a SaaS tool for legal contract automation, we explored a wide range of options — from HTML-to-PDF pipelines to custom templating engines. In the end, the best solution turned out to be something surprisingly old-school: .docx templates.

In this post, I’ll explain how we used Microsoft Word templates, ASP.NET Core, Angular, and Formize API to create Contractize.app — a modern platform for generating legally valid contracts with minimal developer effort.


🚀 Why We Built Contractize

Our goal was simple:

Let startups, HR teams, and freelancers create legally sound contracts in seconds — without needing legal help or Word editing.

We wanted to:

  • Empower non-developers (legal, HR, founders) to manage templates

  • Allow users to generate contracts via a simple form

  • Produce polished PDFs with zero manual formatting

This meant choosing a tech stack that was both developer-friendly and legal-team-friendly.


🛠 The Tech Stack

Here’s what we built the platform with:

  • Frontend: Angular

  • Backend: ASP.NET Core (C#)

  • Document Engine: .docx templates + Formize API

  • Storage: Azure Blob Storage

  • Output: Auto-generated PDFs delivered via link or email


📄 Why .docx Templates (and Not HTML or JSON)?

You might ask: Why not use HTML + PDF generators like Puppeteer or jsPDF?

We tried those. And ran into issues:

  • HTML PDFs often broke with complex layouts

  • Custom JSON-to-PDF pipelines were hard to maintain

  • Legal teams couldn't edit the output without dev help

.docx templates solved all of that:

  • ✅ Created and edited directly in Microsoft Word

  • ✅ Rich formatting: tables, styles, sections

  • ✅ Human-readable placeholders like {{clientName}}

  • ✅ Editable by legal teams without touching the code


🔌 How Our Document Generation Works

Here’s the workflow behind Contractize:

  1. A user fills a contract form on the Angular frontend

  2. The backend builds a data payload

  3. A request is sent to Formize.com:

{
  "templateId": "contract-template.docx",
  "data": {
    "clientName": "Acme Corp",
    "startDate": "2025-05-27",
    "termLength": "12 months"
  }
}
  1. Formize returns a URL to a filled PDF

  2. We display the contract to the user or send it by email

It’s fast, stable, and scales well.


🧠 What We Learned

  • .docx templates are version-controlled in Git

  • Legal teams edit templates without dev involvement

  • Minimal code changes when contract layout updates

  • Formize handles all the parsing/rendering logic

  • Backend stays lean and focused


📈 Scaling the Platform

Today, Contractize automates:

  • NDAs

  • Employment offers

  • Service agreements

  • Partnership contracts

We support:

  • Language toggles (e.g. EN/DE templates)

  • Dynamic clauses (arbitration, term duration)

  • Template sets for different industries


🧭 What’s Next

We’re exploring:

  • E-signature integration (DocuSign, HelloSign)

  • No-code clause toggles in templates

  • Smart template suggestions via AI

  • Analytics on clause usage trends


🔍 TL;DR

If you’re building a platform that involves dynamic document creation:

  • .docx is still unbeatable for legal and professional documents

  • Formize API makes it easy to integrate with modern stacks

  • You don’t need to reinvent templating logic or maintain PDF rendering code

You can check out our platform here:
👉 https://contractize.app


🙋 Let’s Chat

Have you built something similar?
Got questions about integrating .docx in your app?
I’d love to hear from you — drop a comment or connect!

0
Subscribe to my newsletter

Read articles from Bogdan Pilugin directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Bogdan Pilugin
Bogdan Pilugin