Word · C# walkthrough
Reusable service intake template
Reuse one intake layout across many requests. Stable tags connect your application values to document fields without depending on the visible placeholder text.
- Start with
- Template field definitions and request values
- Generate
- DOCX + PDF

How it works
Define stable tags
Create content controls for the request identifier, requester, service, need and outcome. Give each control a readable alias and a stable tag.
Save the blank template
Write template.docx before filling values so the reusable document remains available as a separate download.
Populate a request
Reload the template, find each control by tag and replace its text. Save example.docx as the completed request.
The C# source
This is the complete example file used to generate the download. The walkthrough runner creates the output directory and produces the additional previews.
using OfficeIMO.Word;
namespace OfficeIMO.Examples.Showcase.Workflows;
/// <summary>Saves a reusable tagged DOCX template, then fills a separate request from structured values.</summary>
internal static class ServiceIntake {
internal static void Create(string folder) {
string templatePath = Path.Combine(folder, "template.docx");
using (WordDocument template = WordDocument.Create(templatePath)) {
template.Settings.FontFamily = "Carlito";
template.Settings.FontSize = 11;
template.AddParagraph("Service request").Style = WordParagraphStyles.Heading1;
template.AddParagraph("NORTHWIND / INTAKE / EDITABLE TEMPLATE");
AddField("Request identifier", "request-id");
AddField("Requested by", "requester");
AddField("Service", "service");
AddField("Business need", "need");
AddField("Required outcome", "outcome");
template.AddParagraph("Triage guidance").Style = WordParagraphStyles.Heading2;
template.AddParagraph("Confirm the owner, clarify acceptance criteria and agree the next update before scheduling work.");
foreach (var paragraph in template.Paragraphs) {
paragraph.FontFamily = "Carlito";
paragraph.FontSize = paragraph.Style == WordParagraphStyles.Heading1 ? 26 : paragraph.Style == WordParagraphStyles.Heading2 ? 15 : 11;
paragraph.LineSpacingAfterPoints = 8;
}
template.Save();
void AddField(string label, string tag) {
template.AddParagraph(label).Bold = true;
template.AddStructuredDocumentTag("Enter " + label.ToLowerInvariant(), alias: label, tag: tag);
}
}
using WordDocument request = WordDocument.Load(templatePath);
var values = new Dictionary<string, string> {
["request-id"] = "SR-2048",
["requester"] = "Maya Ellis / Customer Operations",
["service"] = "Request portal",
["need"] = "The support team needs a weekly view of requests waiting for customer input.",
["outcome"] = "A report shows the owner, age and next action for each waiting request."
};
foreach (var value in values) {
var control = request.GetStructuredDocumentTagByTag(value.Key)
?? throw new InvalidOperationException("Missing template field: " + value.Key);
control.Text = value.Value;
}
request.Save(Path.Combine(folder, "example.docx"));
}
}
Open the C# source fileRun it from the source checkout
Clone the OfficeIMO repository and run this command from its root with the .NET 10 SDK. The first run restores the example project's dependencies.
dotnet run --project OfficeIMO.Examples -f net10.0 -- --showcase-workflows --showcase-example word-service-intakeThe files are written to OfficeIMO.Examples/bin/Debug/net10.0/Documents/Workflows/word-service-intake/. To use the example in your application, start with the Word guide and its package setup.
Downloads and scope
What the preview shows
The linked C# example generates this file. The runner reopens and validates the DOCX, exports a PDF, and renders every PDF page for review.
What to keep in mind
The PDF shows the completed request. Download the DOCX files to inspect the editable controls; this example does not add signatures, workflow approval or field locking.