Remove Spacing Between Paragraphs in Address Blocks
When you stack short lines like an address block, IronWord's default paragraph spacing leaves a visible gap between each line. To close that gap, set an exact line-spacing rule on every paragraph so each line gets a fixed height with no extra padding. Verified on IronWord 2026.4.1.
Solution
1. Create the Document and List the Lines
Start a new WordDocument and collect the lines you want stacked together.
WordDocument doc = new WordDocument();
string[] addressLines =
{
"Max Mustermann",
"Musterstraße 42",
"12345 Musterstadt",
"Deutschland"
};
WordDocument doc = new WordDocument();
string[] addressLines =
{
"Max Mustermann",
"Musterstraße 42",
"12345 Musterstadt",
"Deutschland"
};
Dim doc As New WordDocument()
Dim addressLines As String() = {
"Max Mustermann",
"Musterstraße 42",
"12345 Musterstadt",
"Deutschland"
}
2. Apply an Exact Line-Spacing Rule to Each Paragraph
For each line, build a Paragraph and set its LineSpacing to a LineSpacing object using the Exact rule. This gives every line a fixed height and removes the inter-line gap.
foreach (string line in addressLines)
{
Paragraph para = new Paragraph(new TextContent(line));
para.LineSpacing = new IronSoftware.Abstractions.Word.LineSpacing()
{
LineSpacingRule = IronSoftware.Abstractions.Word.LineSpacingRules.Exact,
};
doc.AddParagraph(para);
}
foreach (string line in addressLines)
{
Paragraph para = new Paragraph(new TextContent(line));
para.LineSpacing = new IronSoftware.Abstractions.Word.LineSpacing()
{
LineSpacingRule = IronSoftware.Abstractions.Word.LineSpacingRules.Exact,
};
doc.AddParagraph(para);
}
Dim para As Paragraph
For Each line As String In addressLines
para = New Paragraph(New TextContent(line))
para.LineSpacing = New IronSoftware.Abstractions.Word.LineSpacing() With {
.LineSpacingRule = IronSoftware.Abstractions.Word.LineSpacingRules.Exact
}
doc.AddParagraph(para)
Next
The line-spacing types live in the IronSoftware.Abstractions.Word namespace. Available types and properties vary by version, so confirm against the release you are running.
3. Save the Document
doc.SaveAs("address3.docx");
doc.SaveAs("address3.docx");
doc.SaveAs("address3.docx")

If you prefer an explicit value over the Exact rule, para.SpacingBetweenLines = 210 also produces tight spacing.
Debug Tips
- Do not use
ParagraphSpacing: the class is not available in2026.4.1, even though it appears in some examples. - Avoid zeroing
SpacingBeforeandSpacingAfter: in2026.4.1, setting both to0makes the paragraph text invisible while the paragraph stays in the document. This behavior is under investigation; use the exact line-spacing rule instead.
SpacingBefore and SpacingAfter to 0 in IronWord 2026.4.1 hides the paragraph text. Use the Exact line-spacing rule shown above to control spacing reliably.For more on placing text, see the Add Text how-to.

