Add Shadow Effect

Implementing Shadow Effects on Text

Shadow effects add depth and dimension to text by creating a shadow offset behind the characters. 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. The outer shadow variants project the shadow away from the text, creating a lifted appearance.

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. This approach follows IronWord's document hierarchy and ensures the shadow effect is correctly applied to the output file.

Code Explanation

A shadow effect can be added to text within a Word document with just a few lines of code. 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. This follows the document hierarchy: Document → Paragraph → Run → TextContent. Finally, export the Word document.

For more examples and demonstrations, please navigate to the following article: How to Add Shadow Effect to Text

Explore Document Elements with IronWord Tutorials.

Ready to Get Started?
Nuget Downloads 34,681 | Version: 2026.3 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast? PM > Install-Package IronWord
run a sample watch your data become a Word doc.