How to Add Shadow Effect to Text
The Shadow Effect on text is a visual enhancement technique used to create depth and distinction for text elements. When applied, it introduces a duplicated version of the text behind the original, slightly offset to give the appearance of a shadow. This secondary text, known as the shadow, can be adjusted in several ways to achieve different visual effects.
Get started with IronWord
Start using IronWord in your project today with a free trial.
How to Add Shadow Effect to Text
- Download a C# library to add a shadow effect to text
- Apply the text effect to either newly created or existing text
- Apply a preset shadow effect using the static named instance of the Shadow class
- Configure the Shadow properties to achieve a customized shadow
- Export the edited Word document as a new file
Add Shadow Effect
To specify the shadow effect for the text, create the TextStyle object and populate the ShadowEffect property with a Shadow 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-shadow-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()
{
ShadowEffect = Shadow.OuterShadow1,
};
// Add text with style
doc.AddText("Hello World").Style = textStyle;
// Export new Word document
doc.SaveAs("shadowEffect.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 {.ShadowEffect = Shadow.OuterShadow1}
' Add text with style
doc.AddText("Hello World").Style = textStyle
' Export new Word document
doc.SaveAs("shadowEffect.docx")

Shadow Effect Properties
Besides assigning a predefined shadow value, all of the shadow effect's properties can be configured. This provides a very flexible option to customize the shadow effect in any way possible. Please see the properties and their descriptions below:
- Alignment: Gets or sets the alignment of the shadow.
- BlurRadius: Gets or sets the blur radius of the shadow effect. The blur radius is specified in points (1/72 inch).
- DirectionAngle: Gets or sets the direction angle of the shadow effect. The direction angle is specified in degrees.
- DistanceFromText: Gets or sets the distance of the shadow effect from the text or object. The distance is specified in points (1/72 inch).
- HorizontalScalingFactor: Gets or sets the horizontal scaling factor of the shadow effect.
- HorizontalSkewAngle: Gets or sets the horizontal skew angle of the shadow effect. The skew angle is specified in degrees.
- SchemeColor: Gets or sets the scheme color of the shadow effect.
- VerticalScalingFactor: Gets or sets the vertical scaling factor of the shadow effect.
- VerticalSkewAngle: Gets or sets the vertical skew angle of the shadow effect. The skew angle is specified in degrees.
:path=/static-assets/word/content-code-examples/how-to/text-effect-customized-shadow-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()
{
ShadowEffect = new Shadow()
{
Alignment = RectangleAlignmentValues.BottomLeft,
BlurRadius = 5,
DirectionAngle = 45,
DistanceFromText = 3,
HorizontalScalingFactor = 100,
VerticalScalingFactor = 100,
HorizontalSkewAngle = 0,
SchemeColor = IronWord.Models.Color.Aqua,
VerticalSkewAngle = 0,
},
};
// Add text with style
doc.AddText("Customized shadow").Style = textStyle;
// Export new Word document
doc.SaveAs("customizedShadowEffect.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 {
.ShadowEffect = New Shadow() With {
.Alignment = RectangleAlignmentValues.BottomLeft,
.BlurRadius = 5,
.DirectionAngle = 45,
.DistanceFromText = 3,
.HorizontalScalingFactor = 100,
.VerticalScalingFactor = 100,
.HorizontalSkewAngle = 0,
.SchemeColor = IronWord.Models.Color.Aqua,
.VerticalSkewAngle = 0
}
}
' Add text with style
doc.AddText("Customized shadow").Style = textStyle
' Export new Word document
doc.SaveAs("customizedShadowEffect.docx")

Frequently Asked Questions
What is the shadow effect on text?
The shadow effect on text is a visual enhancement technique that creates depth and distinction by adding a duplicated version of the text behind the original, slightly offset to give the appearance of a shadow.
How can I add a shadow effect to text using IronWord?
To add a shadow effect using IronWord, you need to download a C# library, apply the effect to your text using the Shadow class, customize its properties, and export the document as a new file.
What properties can be customized in a shadow effect?
You can customize properties such as Alignment, BlurRadius, DirectionAngle, DistanceFromText, HorizontalScalingFactor, HorizontalSkewAngle, SchemeColor, VerticalScalingFactor, and VerticalSkewAngle.
What is the BlurRadius property in a shadow effect?
The BlurRadius property specifies the blur radius of the shadow effect in points (1/72 inch), affecting how soft or sharp the shadow appears.
How do I customize the direction of the shadow effect?
You can customize the direction of the shadow effect by setting the DirectionAngle property, which is specified in degrees.
Can the shadow be aligned differently?
Yes, the Alignment property allows you to set the alignment of the shadow relative to the text.
What is the purpose of the SchemeColor property?
The SchemeColor property allows you to set the color scheme of the shadow effect, enabling you to match the shadow with your design theme.
How do I apply a preset shadow effect?
You can apply a preset shadow effect by using the static named instance of the Shadow class and configuring its properties as needed.
Is it possible to apply a shadow effect to existing text?
Yes, you can apply a shadow effect to both newly created and existing text using IronWord.
What is the DistanceFromText property?
The DistanceFromText property specifies the distance of the shadow from the text or object, measured in points (1/72 inch).