IRONSOFTWAREHOME
Add Text Outline
using IronWord;
using IronWord.Models;

// Create new Word document
WordDocument doc = new WordDocument();

// Create and configure text style
TextStyle textStyle = new TextStyle();
textStyle.TextEffect = new TextEffect()
{
    TextOutlineEffect = TextOutlineEffect.DefaultEffect,
};

// Create paragraph
Paragraph paragraph = new Paragraph();

// Create run with text and style
Run textRun = new Run(new TextContent("Hello World"));
textRun.Style = textStyle;

// Add run to paragraph
paragraph.AddChild(textRun);

// Add paragraph to document
doc.AddParagraph(paragraph);

// Export new Word document
doc.SaveAs("textOutlineEffect.docx");
Imports IronWord
Imports IronWord.Models

' Create new Word document
Dim doc As New WordDocument()

' Create and configure text style
Dim textStyle As New TextStyle()
textStyle.TextEffect = New TextEffect() With {
    .TextOutlineEffect = TextOutlineEffect.DefaultEffect
}

' Create paragraph
Dim paragraph As New Paragraph()

' Create run with text and style
Dim textRun As New Run(New TextContent("Hello World"))
textRun.Style = textStyle

' Add run to paragraph
paragraph.AddChild(textRun)

' Add paragraph to document
doc.AddParagraph(paragraph)

' Export new Word document
doc.SaveAs("textOutlineEffect.docx")
NuGet Download
PM > Install-Package IronWord
Add Text Outline

Add Text Outline

Adding Text Outline Effects

Text outline effects enhance text visibility and style by drawing a border around each character. This effect is particularly useful for creating bold, eye-catching text or ensuring readability when text appears over images or colored backgrounds. IronWord provides the TextOutlineEffect class with preset configurations for quick implementation.

To apply a text outline, create a TextStyle object and configure its TextEffect property with TextOutlineEffect.DefaultEffect. This preset provides a standard outline configuration that works well for most scenarios. For custom outlines, developers can specify properties like outline width, color, and line style to achieve specific visual effects.

After setting up the text style, create a Run containing the desired TextContent and assign the configured style to the run's Style property. Use AddChild to add the styled run to a paragraph, then add the paragraph to the document. This structured approach ensures proper formatting and maintains document integrity.

Code Explanation

Applying a text outline to text is super simple with IronWord. Despite its simplicity, each attribute of the text outline can be adjusted to suit every need. Once a Word document is imported, the textStyle is configured to include a text outline effect by assigning TextOutlineEffect.DefaultEffect to the TextOutlineEffect property of a new TextEffect instance.

To apply this effect to text, a Paragraph is created, then a Run object is created containing the desired TextContent. The configured textStyle is assigned to the Run, applying the text outline effect. The Run is added to the Paragraph using AddChild, and the Paragraph is added to the document. This follows the document hierarchy: Document → Paragraph → Run → TextContent. Finally, the document is exported.

Learn more about 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