Cómo Añadir Efecto de Reflejo al Texto en C# | IronWord

How to Add Reflection Effect to Text

This article was translated from English: Does it need improvement?
Translated
View the article in English

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.

Quickstart: Apply Reflection Effect to Text in C#

With just one line of code using IronWord, you can apply a preset reflection effect to any text. Developers get up and running instantly—no complex setup or boilerplate code needed.

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronWord with NuGet Package Manager

    PM > Install-Package IronWord

  2. Copy and run this code snippet.

    new IronWord.WordDocument().AddText("Quick Text").Style = new IronWord.Models.TextStyle(){ TextEffect = new IronWord.Models.TextEffect(){ ReflectionEffect = new IronWord.Models.Reflection() } };
  3. Deploy to test on your live environment

    Start using IronWord in your project today with a free trial
    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
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")
$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 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")
$vbLabelText   $csharpLabel
Customized reflection effect

Preguntas Frecuentes

¿Cómo puedo agregar un efecto de reflexión al texto en un documento de Word usando C#?

Puede agregar un efecto de reflexión al texto en un documento de Word usando C# descargando la biblioteca IronWord. Comience creando un objeto `TextStyle`, llene su propiedad `ReflectionEffect` con un objeto `Reflection` y personalice las propiedades a su gusto. Finalmente, exporte el documento de Word con el efecto de reflexión aplicado.

¿Qué propiedades se pueden ajustar para un efecto de reflexión en IronWord?

En IronWord, puede ajustar propiedades como `SchemeColor`, `HorizontalSkewAngle`, `HorizontalScalingFactor`, `DistanceFromText`, `DirectionAngle`, `FadeDirectionAngle`, `EndPosition`, `StartPosition`, `EndingOpacity`, `VerticalScalingFactor`, `StartingOpacity`, `Alignment`, `BlurRadius` y `VerticalSkewAngle` para personalizar el efecto de reflexión.

¿Cómo personalizo la distancia del efecto de reflexión desde el texto?

En IronWord, use la propiedad `DistanceFromText` para establecer la distancia del efecto de reflexión desde el texto. Esta distancia se especifica en puntos (1/72 pulgada), lo que le permite controlar cuán lejos aparece la reflexión del texto original.

¿Puedo ajustar la opacidad del efecto de reflexión en IronWord?

Sí, la opacidad del efecto de reflexión en IronWord se puede personalizar usando las propiedades `StartingOpacity` y `EndingOpacity`. Estas le permiten definir cuán transparente comienza y termina la reflexión, dándole control sobre su presencia visual.

¿Cuál es el propósito del `HorizontalSkewAngle` en un efecto de reflexión?

La propiedad `HorizontalSkewAngle` en IronWord establece el ángulo de sesgo horizontal del efecto de reflexión. Especificado en grados, esta propiedad altera la apariencia de la reflexión inclinándola horizontalmente.

¿Cómo empiezo a agregar un efecto de reflexión al texto en C#?

Comience descargando la biblioteca IronWord. Cree un objeto `TextStyle` y llene la propiedad `ReflectionEffect` con un objeto `Reflection`. Use las propiedades disponibles para personalizar el efecto y aplíquelo a su texto.

¿Es posible ajustar el desenfoque de un efecto de reflexión en IronWord?

Sí, puede ajustar el desenfoque de un efecto de reflexión en IronWord estableciendo la propiedad `BlurRadius`. Este valor se especifica en puntos (1/72 pulgada), lo que le permite controlar la suavidad de la reflexión.

Curtis Chau
Escritor Técnico

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien ...

Leer más
¿Listo para empezar?
Nuget Descargas 25,807 | Versión: 2025.11 recién lanzado