How to Add Text Outline Effect to Text
A text outline effect adds a visible border around the characters of text, creating a defined outline that enhances readability or visual impact. This effect can be customized in terms of color, thickness, and style to suit design preferences. It's commonly used in graphics, typography, and digital design to make text stand out against backgrounds or to create a stylized appearance.
Get started with IronWord
Start using IronWord in your project today with a free trial.
How to Add Text Outline Effect to Text
- Download a C# library to add a text outline to text
- Apply the text effect to either newly created or existing text
- Apply a preset text outline effect using the static named instance of the TextOutlineEffect class
- Configure the TextOutlineEffect properties to achieve a customized text outline
- Export the edited Word document as a new file
Add Text Outline Effect
To specify the text outline effect for the text, create the TextStyle object and populate the TextOutlineEffect property with a TextOutlineEffect object. Finally, add new text with the style by assigning the TextStyle object to the TextEffect property.
:path=/static-assets/word/content-code-examples/how-to/text-effect-text-outline-effect.cs
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,
};
// Add text with style
doc.AddText("Hello World").Style = textStyle;
// Export new Word document
doc.SaveAs("textOutlineEffect.docx");
Imports IronWord
Imports IronWord.Models
' Create new Word document
Private doc As New WordDocument()
' Create and configure text style
Private textStyle As New TextStyle()
textStyle.TextEffect = New TextEffect() With {.TextOutlineEffect = TextOutlineEffect.DefaultEffect}
' Add text with style
doc.AddText("Hello World").Style = textStyle
' Export new Word document
doc.SaveAs("textOutlineEffect.docx")

Text Outline Effect Properties
The text outline effect offers a variety of customizable properties to suit any design need. Below are the properties along with their descriptions:
- PenAlignment: Gets or sets the alignment of the pen used for the outline effect.
- LineCapType: Gets or sets the type of line cap used for the outline effect.
- LineWidth: Gets or sets the width of the outline effect line. Note: The width is specified in points (1/72 inch).
- CompoundLineType: Gets or sets the type of compound line used for the outline effect.
- LineJoin: Gets or sets the stroke join style used for the outline effect.
- Color: Gets or sets the solid fill color for the outline effect.
- PresetLineDash: Gets or sets the preset line dash style for the outline effect.
:path=/static-assets/word/content-code-examples/how-to/text-effect-customized-text-outline-effect.cs
using IronWord;
using IronWord.Models;
using IronWord.Models.Enums;
// Create new Word document
WordDocument doc = new WordDocument();
// Create and configure text style
TextStyle textStyle = new TextStyle();
textStyle.TextEffect = new TextEffect()
{
TextOutlineEffect = new TextOutlineEffect()
{
Color = IronWord.Models.Color.Red,
CompoundLineType = CompoundLineValues.Double,
LineCapType = LineCapValues.Round,
LineJoin = StrokeJoinStyleValues.Bevel,
LineWidth = 0.3,
PenAlignment = PenAlignmentValues.Center,
presetLineDash = PresetLineDashValues.Solid
},
};
// Add text with style
doc.AddText("Customized text outline").Style = textStyle;
// Export new Word document
doc.SaveAs("customizedTextOutlineEffect.docx");
Imports IronWord
Imports IronWord.Models
Imports IronWord.Models.Enums
' Create new Word document
Private doc As New WordDocument()
' Create and configure text style
Private textStyle As New TextStyle()
textStyle.TextEffect = New TextEffect() With {
.TextOutlineEffect = New TextOutlineEffect() With {
.Color = IronWord.Models.Color.Red,
.CompoundLineType = CompoundLineValues.Double,
.LineCapType = LineCapValues.Round,
.LineJoin = StrokeJoinStyleValues.Bevel,
.LineWidth = 0.3,
.PenAlignment = PenAlignmentValues.Center,
.presetLineDash = PresetLineDashValues.Solid
}
}
' Add text with style
doc.AddText("Customized text outline").Style = textStyle
' Export new Word document
doc.SaveAs("customizedTextOutlineEffect.docx")

Frequently Asked Questions
What is a text outline effect?
A text outline effect adds a visible border around the characters of text, enhancing readability or visual impact. It can be customized in terms of color, thickness, and style.
How can I start using a C# library to add a text outline effect?
To get started with IronWord, download a C# library designed for text editing, such as IronWord, which facilitates adding text effects.
What steps are involved in adding a text outline effect with a C# library?
The steps include downloading a C# library, applying the text effect, configuring the TextOutlineEffect properties, and exporting the edited Word document.
How do I apply a preset text outline effect using a C# library?
You can apply a preset text outline effect using the static named instance of the TextOutlineEffect class in IronWord.
What properties can be customized in the text outline effect?
The properties include PenAlignment, LineCapType, LineWidth, CompoundLineType, LineJoin, Color, and PresetLineDash.
Can I customize the text outline effect using a C# library?
Yes, you can customize the text outline effect by configuring properties like line width, color, and style using the TextOutlineEffect object in IronWord.
How do I define a text style with a text outline effect in C#?
Define a TextStyle object and populate the TextOutlineEffect property with a TextOutlineEffect object, then assign it to the TextEffect property of your text.
What is the unit of measurement for the line width in a text outline effect?
The line width is specified in points, where one point is 1/72 of an inch.
Can I export the document after applying a text outline effect?
Yes, after applying a text outline effect, you can export the edited Word document as a new file using IronWord.
What is the purpose of using a text outline effect?
The purpose of using a text outline effect is to make text stand out against backgrounds or to create a stylized appearance, enhancing readability or visual impact.