Module · Regira.Office.Word

Word in .NET.
Templates, not string building.

A .docx someone made in Word stays the design; your code supplies the values. Placeholders take single values, loops write a passage or a table row once per item, conditional blocks keep or drop a passage, and the same service converts the result to PDF.

← All Office modules

§ 01The contract

What every provider gives you.

The interfaces below are the part that does not change when you swap the library underneath. Each provider then adds whatever extras its own library exposes.

01

Template + parameters

WordTemplateInput carries the document and two dictionaries: one for single values, one for collections. {{#each Key}} … {{else}} … {{/each}} writes a passage or a set of table rows once per item, and {{#if Key}} … {{else}} … {{/if}} keeps one branch or the other. The two nest in each other.

02

Convert

Convert a generated document to PDF or another format through the same service — no second library for the signing copy.

03

Merge

Append an addendum, a set of terms or a cover page by merging several template inputs into one document.

04

Extract

Pull plain text or embedded images back out, for indexing or for migrating content off old documents.

Interfaces
IWordServiceIWordCreatorIWordConverterIWordMergerIWordTextExtractorIWordImageExtractor
§ 02Providers

5 published implementations.

Install the one that fits your runtime and licensing, and name it once at registration. Every package here is published on nuget.org.

AsposeGotenbergMiniWordSpireSyncfusion
§ 03In code

Inject the interface. Name the provider once.

The provider appears where the concrete class is constructed, and nowhere else. Always-current samples live in the package documentation.

Fill a template, then convert to PDFC#
// A .docx template plus values. {{#each Sites}} … {{/each}} writes its passage once per row;
// {{#if IsPaid}} … {{else}} … {{/if}} keeps the branch that holds.
IWordService word = new Regira.Office.Word.Spire.WordService();

IMemoryFile contract = await word.Create(new WordTemplateInput
{
    Template         = template,
    GlobalParameters = new Dictionary<string, object>
    {
        ["ClientName"] = client.Name,
        ["StartDate"]  = start.ToString("d"),
        ["IsPaid"]     = invoice.AmountPaid > 0
    },
    CollectionParameters = new Dictionary<string, ICollection<IDictionary<string, object>>>
    {
        ["Sites"] = sites // one row per site: {{SiteName}}, {{Address}}, {{ row_number }}
    }
});

// Same service converts and merges. FreeSpire writes at most 3 PDF pages and adds a notice page;
// Word.Syncfusion, Word.Aspose or Word.Gotenberg convert longer documents.
IMemoryFile pdf = await word.Convert(new WordTemplateInput { Template = contract }, FileFormat.Pdf);
§ 04Without .NET

The same thing, over HTTP.

Create a Word document from a template, extract plain text, merge documents and convert between DOCX and PDF over HTTP.

Call it from any language.

The free tier needs no key and is rate-limited to 5 requests / 60 s. A trial or commercial key removes the limit — send it in the X-License-Key header.

Also explore

PDF

Generate PDFs from HTML or from Word, Excel and PowerPoint files, merge and split them, extract text and render pages as images — over PdfPig, Playwright, Gotenberg, MiniPdf and more.