IRONSOFTWAREHOME
Add Paragraph
using IronWord;
using IronWord.Models;

// Load docx
WordDocument doc = new WordDocument("document.docx");

// Configure text
TextContent introText = new TextContent("This is an example paragraph with italic and bold styling.");

TextStyle italicStyle = new TextStyle()
{
    IsItalic = true
};
Run italicRun = new Run(new TextContent("Italic example sentence."));
italicRun.Style = italicStyle;

TextStyle boldStyle = new TextStyle()
{
    IsBold = true
};
Run boldRun = new Run(new TextContent("Bold example sentence."));
boldRun.Style = boldStyle;

Paragraph paragraph = new Paragraph();

// Add text
paragraph.AddText(introText);
paragraph.AddChild(italicRun);
paragraph.AddChild(boldRun);

// Add paragraph
doc.AddParagraph(paragraph);

// Export docx
doc.SaveAs("save_document.docx");
Imports IronWord
Imports IronWord.Models

' Load docx
Dim doc As New WordDocument("document.docx")

' Configure text
Dim introText As New TextContent("This is an example paragraph with italic and bold styling.")

Dim italicStyle As New TextStyle() With {
    .IsItalic = True
}
Dim italicRun As New Run(New TextContent("Italic example sentence."))
italicRun.Style = italicStyle

Dim boldStyle As New TextStyle() With {
    .IsBold = True
}
Dim boldRun As New Run(New TextContent("Bold example sentence."))
boldRun.Style = boldStyle

Dim paragraph As New Paragraph()

' Add text
paragraph.AddText(introText)
paragraph.AddChild(italicRun)
paragraph.AddChild(boldRun)

' Add paragraph
doc.AddParagraph(paragraph)

' Export docx
doc.SaveAs("save_document.docx")
NuGet Download
PM > Install-Package IronWord
Add Paragraph

Add Paragraph

The "add-paragraph" feature in IronWord allows developers to insert entire paragraphs into an existing Word document, providing an efficient way to structure and organize content. By adding a paragraph, developers can combine multiple pieces of text, each with different formatting, into a cohesive block. This feature is especially useful for constructing dynamic documents where text needs to be grouped and styled together, such as reports, articles, or letters.

It offers flexibility in how text is presented, enabling the inclusion of various formatting options like bold, italic, and other styles within a single paragraph. The ability to add paragraphs helps maintain a clean document structure and ensures content is properly organized for readability.

Adding Paragraphs in C#

The Paragraph class in IronWord represents a block of text that can contain both unstyled text and styled content. When working with paragraphs, developers can combine plain TextContent with styled Run objects to create rich, formatted text blocks.

To add plain text directly to a paragraph, use the AddText method with a TextContent object. This is ideal for unstyled text that doesn't require specific formatting. For styled content, create a Run object containing TextContent, then assign a TextStyle to the Run. The TextStyle can specify formatting such as bold, italic, font family, font size, and color.

Once the Run is styled, use the AddChild method to add it to the paragraph. This is a general-purpose method that accepts any content element, including Run objects with formatting; a dedicated AddRun method is also available specifically for adding Run objects. A single paragraph can contain multiple runs with different styles, allowing for flexible text formatting within a unified block.

After constructing the paragraph with all desired content, use AddParagraph on the WordDocument to insert it into the document. This approach follows the document hierarchy: WordDocumentDocumentSectionParagraphRunTextContent, ensuring proper structure and formatting preservation when the document is saved.

Explore more on Document Elements with IronWord
View on GitHub

Ready to Get Started?

Nuget Downloads 56,401Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required