IronWord How to Remove Spacing Between Paragraphs for Multi-Line Address Blocks
Overview
When you stack short lines like an address block in IronWord, the default paragraph spacing leaves a gap between each line. This article shows you how to remove that gap by setting an exact line-spacing rule on each paragraph. The approach is verified on IronWord 2026.4.1.
Prerequisites- IronWord 2026.4.1
- A .NET project
- Create the document and list the lines you want to stack together.
- For each line, create a
Paragraphand set itsLineSpacingto aLineSpacingobject that uses theExactrule. This gives each line a fixed height with no extra gap. - Add each paragraph to the document and save.
Complete working example:
WordDocument doc = new WordDocument();
string[] addressLines =
{
"Max Mustermann",
"Musterstraße 42",
"12345 Musterstadt",
"Deutschland"
};
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); } doc.SaveAs("address3.docx");
Result:

Notes and Limitations
- Do not use the
ParagraphSpacingclass. It is not available in IronWord 2026.4.1, even though it appears in some examples. - In 2026.4.1, setting
SpacingBeforeandSpacingAfterto0does not work as expected. The paragraph text becomes invisible while the paragraph stays in the document. This behavior is under investigation. Use the exact line-spacing rule shown above instead. - Alternative:
para.SpacingBetweenLines = 210also produces tight spacing if you prefer to set an explicit value. - Available types and properties vary by version. The line-spacing types here live in the
IronSoftware.Abstractions.Wordnamespace.