Header Disappears After SaveAs in IronWord
SaveAs() as their standard save call with no reported header loss. Treat this as a possible environment-specific quirk rather than a confirmed product defect, and verify against your own environment before applying the workaround below.In some environments, populating a DOCX template with IronWord and writing the result with SaveAs() has been observed to drop the template's header from the generated file, even though the placeholders merge correctly.
Header (e.g. "City Attorney Cover Sheet") is visible in the original DOCX
but missing in the generated file after calling SaveAs().

In the environment where this was observed, the header was preserved when writing the document with Save() rather than SaveAs(). This has not been corroborated across other environments or in IronWord's changelog — other IronWord guides use SaveAs() as their standard save call without a header-loss issue, so treat this as environment-specific rather than a confirmed product defect.
Solution
1. Load the Template
Open the source DOCX with WordDocument.
using IronWord;
using System.Collections.Generic;
var templatePath = @"C:\Templates\CityAttorneyCoverSheetTemplate.docx";
var outputPath = @"C:\Output\merged.docx";
var doc = new WordDocument(templatePath);
using IronWord;
using System.Collections.Generic;
var templatePath = @"C:\Templates\CityAttorneyCoverSheetTemplate.docx";
var outputPath = @"C:\Output\merged.docx";
var doc = new WordDocument(templatePath);
Imports IronWord
Imports System.Collections.Generic
Dim templatePath As String = "C:\Templates\CityAttorneyCoverSheetTemplate.docx"
Dim outputPath As String = "C:\Output\merged.docx"
Dim doc As New WordDocument(templatePath)
2. Replace the Placeholders
Merge your values through doc.Texts, a straightforward find/replace approach; for placeholder-heavy templates using MERGEFIELD syntax, IronWord's dedicated WordDocument.MailMerge API is also available.
var replacements = new Dictionary<string, string>
{
["{CaseNumber}"] = "2026-CR-12345",
["{DefendantName}"] = "John Doe",
["{DefendantAge}"] = "34",
["{DefendantAttorney}"] = "Jane Smith",
};
foreach (var kv in replacements)
{
doc.Texts.ForEach(t => t.Replace(kv.Key, kv.Value));
}
var replacements = new Dictionary<string, string>
{
["{CaseNumber}"] = "2026-CR-12345",
["{DefendantName}"] = "John Doe",
["{DefendantAge}"] = "34",
["{DefendantAttorney}"] = "Jane Smith",
};
foreach (var kv in replacements)
{
doc.Texts.ForEach(t => t.Replace(kv.Key, kv.Value));
}
Imports System.Collections.Generic
Dim replacements As New Dictionary(Of String, String) From {
{"{CaseNumber}", "2026-CR-12345"},
{"{DefendantName}", "John Doe"},
{"{DefendantAge}", "34"},
{"{DefendantAttorney}", "Jane Smith"}
}
For Each kv In replacements
doc.Texts.ForEach(Sub(t) t.Replace(kv.Key, kv.Value))
Next
Iterating each entry over doc.Texts swaps every placeholder token for its merge value across the document body.
3. Save With Save(), Not SaveAs()
In the environment where this issue was observed, writing the output with doc.Save(outputPath) kept the header intact, while doc.SaveAs(outputPath) dropped it. Treat this as a workaround to try, not a confirmed universal behavior difference between the two methods.
doc.Save(outputPath);
doc.Save(outputPath);
doc.Save(outputPath)

Notes
- If your workflow requires
SaveAs(): verify on the latest IronWord version whether the header survives in your environment. - If the issue reappears: pin to a previously working version as a short-term mitigation while the behavior is investigated.

