How to Add Reflection Effect to Text

A reflection effect on text is a visual enhancement that creates a mirror-like image of the text below its original form. This effect simulates the reflection of the text on a surface, often adding depth and realism to the design.

C# NuGet Library for

Install with NuGet

Install-Package IronWord

Add Reflection Effect

To specify the reflection effect for the text, create the TextStyle object and populate the ReflectionEffect property with a Reflection 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-reflection-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()
{
    ReflectionEffect = new Reflection(),
};

// Add text with style
doc.AddText("Hello World").Style = textStyle;

// Export new Word document
doc.SaveAs("reflectionEffect.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 {.ReflectionEffect = New Reflection()}

' Add text with style
doc.AddText("Hello World").Style = textStyle

' Export new Word document
doc.SaveAs("reflectionEffect.docx")
VB   C#
Add reflection effect

Reflection Effect Properties

The reflection effect provides a range of adjustable attributes to meet diverse design requirements. See the following list for detailed descriptions of each property:

  • SchemeColor: Gets or sets the scheme color of the reflection effect.
  • HorizontalSkewAngle: Gets or sets the horizontal skew angle of the reflection effect. The skew angle is specified in degrees.
  • HorizontalScalingFactor: Gets or sets the horizontal scaling factor of the reflection effect.
  • DistanceFromText: Gets or sets the distance of the reflection effect from the text or object. The distance is specified in points (1/72 inch).
  • DirectionAngle: Gets or sets the direction angle of the reflection effect. The direction angle is specified in degrees.
  • FadeDirectionAngle: Gets or sets the fade direction of the reflection effect.
  • EndPosition: Gets or sets the ending position of the reflection effect.
  • StartPosition: Gets or sets the starting position of the reflection effect.
  • EndingOpacity: Gets or sets the ending opacity of the reflection effect.
  • VerticalScalingFactor: Gets or sets the vertical scaling factor of the reflection effect.
  • StartingOpacity: Gets or sets the starting opacity of the reflection effect.
  • Alignment: Gets or sets the alignment of the reflection effect.
  • BlurRadius: Gets or sets the blur radius of the reflection effect. The blur radius is specified in points (1/72 inch).
  • VerticalSkewAngle: Gets or sets the vertical skew angle of the reflection effect. The skew angle is specified in degrees.
:path=/static-assets/word/content-code-examples/how-to/text-effect-customized-reflection-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()
{
    ReflectionEffect = new Reflection()
    {
        Alignment = RectangleAlignmentValues.BottomLeft,
        BlurRadius = 5,
        DirectionAngle = 90,
        DistanceFromText = 5,
        EndingOpacity = 100,
        EndPosition = 10,
        FadeDirectionAngle = 90,
        HorizontalScalingFactor = 100,
        HorizontalSkewAngle = 0,
        SchemeColor = IronWord.Models.Color.Gold,
        StartingOpacity = 0,
        StartPosition = 0,
        VerticalScalingFactor = -100,
        VerticalSkewAngle = 0,
    },
};

// Add text with style
doc.AddText("Customized reflection").Style = textStyle;

// Export new Word document
doc.SaveAs("customizedReflectionEffect.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 {
	.ReflectionEffect = New Reflection() With {
		.Alignment = RectangleAlignmentValues.BottomLeft,
		.BlurRadius = 5,
		.DirectionAngle = 90,
		.DistanceFromText = 5,
		.EndingOpacity = 100,
		.EndPosition = 10,
		.FadeDirectionAngle = 90,
		.HorizontalScalingFactor = 100,
		.HorizontalSkewAngle = 0,
		.SchemeColor = IronWord.Models.Color.Gold,
		.StartingOpacity = 0,
		.StartPosition = 0,
		.VerticalScalingFactor = -100,
		.VerticalSkewAngle = 0
	}
}

' Add text with style
doc.AddText("Customized reflection").Style = textStyle

' Export new Word document
doc.SaveAs("customizedReflectionEffect.docx")
VB   C#
Customized reflection effect