Skip to main content
net10.0

Parchment is a Word document generation library that combines docx templates or markdown with a .NET data model via liquid templating.

Published
Jul 13, 2026
3mo ago
Total Downloads
7.5K
7,512

Install

dotnet add package Parchment --version 3.1.0-beta.9
ProductVersions
.NET
net10.0

README

Parchment

Parchment is a Word (.docx) generation library that combines a .NET data model with either a docx template (token replacement) or a markdown template (full content rendering), driven by liquid via Fluid, Markdig, and OpenXmlHtml.

Docx template flow

var store = new TemplateStore();
store.RegisterDocxTemplate<Invoice>("invoice", File.ReadAllBytes("invoice-template.docx"));
var bytes = await store.Render("invoice", SampleData.Invoice());
File.WriteAllBytes("out.docx", bytes);

The template may include:

  • Substitution tokens: {{ customer.name }}
  • Paragraph-scope loops: {% for line in lines %} … {% endfor %}
  • Table-row-scope loops: put {% for line in lines %} on its own in one row and {% endfor %} on its own in another
  • Conditionals: {% if customer.is_preferred %} … {% endif %}

Markdown template flow

store.RegisterMarkdownTemplate<Report>("report", markdownSource, styleSource: brandDocxBytes);
var bytes = await store.Render("report", reportModel);

Source generator

Decorate the model class itself with [ParchmentModel] and Parchment's source generator validates the template tokens against it at compile time. Both .docx and .md templates are supported.

[ParchmentModel("Templates/invoice.docx")]
public partial class Invoice
{
    public string Number { get; set; } = "";
    // ...
}

[ParchmentModel("Templates/report.md")]
public partial class Report
{
    public string Title { get; set; } = "";
    // ...
}

See the readme for full documentation.

Changes from Previous Version

No structural changes between v3.1.0-beta.8 and v3.1.0-beta.9.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.