Agregar efecto de sombra

Implementar efectos de sombra en el texto

Los efectos de sombra añaden profundidad y dimensión al texto al crear una sombra desplazada detrás de los caracteres. IronWord provides predefined shadow presets through the Shadow class, offering various shadow styles that can be applied quickly without manual configuration.

To add a shadow effect, create a TextStyle and configure its TextEffect property with a shadow preset such as Shadow.OuterShadow1. These static named instances from the Shadow class provide professionally designed shadow configurations with appropriate blur, distance, and angle settings. Las variantes de sombras exteriores proyectan la sombra lejos del texto, creando una apariencia levantada.

Once the text style is configured with the desired shadow effect, create a Run object containing TextContent and assign the style to the run. Add the styled run to a paragraph using AddChild, then include the paragraph in the document. Este enfoque sigue la jerarquía de documentos de IronWord y garantiza que el efecto de sombra se aplique correctamente al archivo de salida.

Explicación del código

Se puede agregar un efecto de sombra al texto dentro de un documento de Word con solo unas pocas líneas de código. For completeness, let's first initialize a new WordDocument instance called doc. Then, a TextStyle object is created and configured to incorporate a shadow effect by assigning the Shadow.OuterShadow1 static named instance to the TextEffect property.

To add the styled text with the shadow effect, a Paragraph is created, then a Run object is created containing TextContent with "Hello World". The configured textStyle is assigned to the Run, applying the shadow effect. The Run is added to the Paragraph using AddChild, and the Paragraph is added to the document. Esto sigue la jerarquía del documento: Documento → Párrafo → Ejecutar → Contenido de texto. Finalmente, exporta el documento de Word.

Para más ejemplos y demostraciones, por favor navegue al siguiente artículo: Cómo agregar efecto de sombra al texto

Explore los elementos del documento con los tutoriales de IronWord.

¿Listo para empezar?
Nuget Descargas 36,374 | Versión: 2026.3 recién lanzado
Still Scrolling Icon

¿Aún desplazándote?

¿Quieres una prueba rápida? PM > Install-Package IronWord
ejecuta una muestra observa cómo tus datos se convierten en un documento de Word.