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.

Get started with IronWord

Start using IronWord in your project today with a free trial.

First Step:
green arrow pointer


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
// Import necessary namespaces for working with IronWord
using IronWord;
using IronWord.Models;

// Create a new Word document using the IronWord library
WordDocument doc = new WordDocument();

// Create and configure a text style with a text effect
TextStyle textStyle = new TextStyle()
{
    // Apply text effects to the style
    TextEffect = new TextEffect()
    {
        // Add reflection effect to the text, giving it a reflection appearance
        ReflectionEffect = new Reflection()
    }
};

// Add text "Hello World" to the document and apply the specified style
// The text style will include the reflection effect defined above
doc.AddText("Hello World").Style = textStyle;

// Save the Word document to a file named "reflectionEffect.docx"
// This will export the document with the formatted text included
doc.SaveAs("reflectionEffect.docx");
' Import necessary namespaces for working with IronWord
Imports IronWord
Imports IronWord.Models

' Create a new Word document using the IronWord library
Private doc As New WordDocument()

' Create and configure a text style with a text effect
Private textStyle As New TextStyle() With {
	.TextEffect = New TextEffect() With {.ReflectionEffect = New Reflection()}
}

' Add text "Hello World" to the document and apply the specified style
' The text style will include the reflection effect defined above
doc.AddText("Hello World").Style = textStyle

' Save the Word document to a file named "reflectionEffect.docx"
' This will export the document with the formatted text included
doc.SaveAs("reflectionEffect.docx")
$vbLabelText   $csharpLabel
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 a new Word document
WordDocument doc = new WordDocument();

// Create and configure text style with reflection effect
TextStyle textStyle = new TextStyle();
textStyle.TextEffect = new TextEffect()
{
    ReflectionEffect = new Reflection()
    {
        // Set alignment of the reflection effect 
        Alignment = RectangleAlignmentValues.BottomLeft,
        
        // Set blur radius for reflection
        BlurRadius = 5,
        
        // Set direction angle for the reflection
        DirectionAngle = 90,
        
        // Set distance of reflection from text
        DistanceFromText = 5,
        
        // Final opacity of the reflection effect (0 = transparent, 100 = opaque)
        EndingOpacity = 100,
        
        // Position where the reflection ends (in percentage relative to its total length)
        EndPosition = 10,
        
        // Set fade effect direction for reflection
        FadeDirectionAngle = 90,
        
        // The horizontal scaling factor can affect the width appearance of reflection (100 = no scale)
        HorizontalScalingFactor = 100,
        
        // Horizontal skew angle for adding perspective to the reflection
        HorizontalSkewAngle = 0,
        
        // Color of the reflection effect
        SchemeColor = IronWord.Models.Color.Gold,
        
        // Initial opacity of the reflection (0 = transparent)
        StartingOpacity = 0,
        
        // Position where the reflection starts (in percentage relative to its total length)
        StartPosition = 0,
        
        // Vertical scaling factor can affect the height appearance of reflection (-100 = flip, 100 = no scale)
        VerticalScalingFactor = -100,
        
        // Vertical skew angle for adding perspective to the reflection
        VerticalSkewAngle = 0,
    },
};

// Add text with the configured style to the document and assign the style
doc.AddText("Customized reflection").Style = textStyle;

// Save and export the newly created Word document
doc.SaveAs("customizedReflectionEffect.docx");
Imports IronWord
Imports IronWord.Models
Imports IronWord.Models.Enums

' Create a new Word document
Private doc As New WordDocument()

' Create and configure text style with reflection effect
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 the configured style to the document and assign the style
doc.AddText("Customized reflection").Style = textStyle

' Save and export the newly created Word document
doc.SaveAs("customizedReflectionEffect.docx")
$vbLabelText   $csharpLabel
Customized reflection effect

Frequently Asked Questions

What is a reflection effect on text?

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

How can I add a reflection effect to text using IronWord?

To add a reflection effect using IronWord, download a C# library, apply the text effect to the text, instantiate the Reflection class, configure its properties, and export the edited Word document as a new file.

What is the purpose of the Reflection class in IronWord?

The Reflection class in IronWord is used to apply preset reflection effects to text and configure properties to customize the text's appearance.

How do I customize the reflection effect properties?

Customize the reflection effect by adjusting properties such as SchemeColor, HorizontalSkewAngle, HorizontalScalingFactor, DistanceFromText, DirectionAngle, and others using the Reflection object in IronWord.

What are some key properties of the reflection effect in IronWord?

Key properties include SchemeColor, HorizontalSkewAngle, HorizontalScalingFactor, DistanceFromText, DirectionAngle, FadeDirectionAngle, EndPosition, StartPosition, EndingOpacity, VerticalScalingFactor, StartingOpacity, Alignment, BlurRadius, and VerticalSkewAngle.

What is the HorizontalSkewAngle property used for in reflection effects?

The HorizontalSkewAngle property sets the horizontal skew angle of the reflection effect, specified in degrees, to alter the appearance of the reflection.

How does the DistanceFromText property affect the reflection effect?

The DistanceFromText property sets the distance of the reflection effect from the text or object, specified in points (1/72 inch), affecting how far the reflection appears from the original text.

Can the reflection effect's opacity be customized?

Yes, the reflection effect's opacity can be customized using the StartingOpacity and EndingOpacity properties to define how transparent the reflection starts and ends.

Chaknith Bin
Software Engineer
Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience.