Parchment 7.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Parchment --version 7.1.1
                    
NuGet\Install-Package Parchment -Version 7.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Parchment" Version="7.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Parchment" Version="7.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Parchment" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Parchment --version 7.1.1
                    
#r "nuget: Parchment, 7.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Parchment@7.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Parchment&version=7.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Parchment&version=7.1.1
                    
Install as a Cake Tool

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.

A template belongs to its model type and is rendered by it — one template per model, no names to repeat.

Decorate the model class itself with [ParchmentModel] and Parchment's source generator finds the template by convention — the AdditionalFiles entry named after the type (Invoice.docx or Report.md) — validates its tokens against the model at compile time, and embeds it into the generated source. A module initializer registers it when the assembly loads, so rendering is the whole API:

[ParchmentModel]
public partial class Invoice
{
    public string Number { get; set; } = "";
    // ...
}

var store = new TemplateStore();

using var stream = new MemoryStream();
await store.Render(invoice, stream);

A markdown template's style source is found by convention too: Report.dotx, or the nearest parchment.dotx up the directory tree — embedded alongside the template.

Registering by hand

For templates the generator cannot see — content produced at runtime, per-tenant templates — register against the model type directly. The model still goes through the generator: mark it [ParchmentBindable] (and partial) so its accessors are pre-compiled without binding a template.

A docx template:

[ParchmentBindable]
public partial class Invoice
{
    // ...
}

var store = new TemplateStore();
store.RegisterDocxTemplate<Invoice>("invoice-template.docx");

using var stream = new MemoryStream();
await store.Render(invoice, stream);

A markdown template, with an optional style source — a Stream over a Word template (.dotx) whose styles the output inherits:

store.RegisterMarkdownTemplate<Report>(markdownSource, styleSource);

Render writes to a stream the caller supplies. To write straight to disk, use RenderToFile:

await store.RenderToFile(invoice, "out.docx");

Template content

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.IsPreferred %}{% endif %}

Members are resolved against the model by name. There is no snake-case translation layer, so use the property names as declared.

See the readme for full documentation.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Parchment:

Package Downloads
Parchment.Morph

Resolves Parchment's table-of-contents and page-reference fields by laying the document out with Morph, so the numbers are in the file before Word opens it.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.5.0 110 9/2/2026
7.4.0 114 8/27/2026
7.3.0 115 8/24/2026
7.2.1 116 8/19/2026
7.2.0 124 8/18/2026
7.1.2 126 8/18/2026
7.1.1 122 8/17/2026
7.1.0 125 8/14/2026
7.0.4 122 8/10/2026
7.0.3 130 8/10/2026
7.0.2 119 8/10/2026
7.0.0 110 8/10/2026
6.2.3 118 8/8/2026
6.2.2 112 8/8/2026
6.2.1 105 8/8/2026
6.2.0 115 8/7/2026
6.1.0 110 8/6/2026
6.0.0 112 8/6/2026
5.0.0 111 8/6/2026
4.3.0 121 8/5/2026
Loading failed