How to Add Shadow Effect to Text in C# | IronWord

How to Add Shadow Effect to Text in C#

Add shadow effects to text in C# using IronWord by creating a TextStyle object with a ShadowEffect property, then apply preset shadows like OuterShadow1 or customize properties like blur, distance, and color for professional text depth.

The Shadow Effect on text is a visual enhancement technique used to create depth and distinction for text elements. When applied, it introduces a duplicated version of the text behind the original, slightly offset to give the appearance of a shadow. This secondary text, known as the shadow, can be adjusted in several ways to achieve different visual effects.

Shadow effects are particularly useful when creating professional documents, presentations, and reports where text needs to stand out. Similar to how you might create empty presentations in PowerPoint, IronWord enables you to programmatically enhance your Word documents with sophisticated text effects. The library provides both preset shadow options for quick implementation and extensive customization capabilities for unique branding requirements.

Quickstart: Add a Preset Shadow Effect in One Line

Here's how to enhance your Word document text with a shadow using IronWord—just one line to define style and shadow, plus save. Quick implementation with minimal setup. Before implementing shadow effects, ensure you've properly configured your license keys to avoid watermarks in production documents.

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("Shadow!").Style = new IronWord.Models.TextStyle { TextEffect = new IronWord.Models.TextEffect { ShadowEffect = IronWord.Models.Shadow.OuterShadow1 } };
  3. Deploy to test on your live environment

    Start using IronWord in your project today with a free trial
    arrow pointer

How Do I Add a Shadow Effect to Text?

To specify the shadow effect for the text, create the TextStyle object and populate the ShadowEffect property with a Shadow object. Finally, add new text with the style by assigning the TextStyle object to the TextEffect property.

The implementation process follows a straightforward pattern that integrates seamlessly with existing document generation workflows. Whether you're building automated reports, generating certificates, or creating branded documentation, shadow effects add a professional polish to your text elements. For organizations considering licensing options, IronWord's shadow effects are included in all license tiers, ensuring consistent functionality across development, testing, and production environments.

Which Preset Shadow Effects Are Available?

IronWord provides several built-in shadow presets like OuterShadow1 through OuterShadow20 that offer different visual styles. These presets provide quick implementation without manual configuration. Each preset has been carefully designed to match common use cases in professional document creation:

  • OuterShadow1-5: Subtle shadows for body text and headings
  • OuterShadow6-10: Medium-intensity shadows for titles and emphasis
  • OuterShadow11-15: Bold shadows for cover pages and section dividers
  • OuterShadow16-20: Dramatic effects for presentations and creative documents

To stay updated with new preset additions and enhancements, check the changelog regularly. The development team continuously refines these presets based on user feedback and industry trends.

When Should I Use Preset vs Custom Shadow Effects?

Use preset shadows for standard document formatting and quick implementations. Choose custom shadows when you need specific branding requirements or unique visual effects that presets don't provide. Preset shadows excel in scenarios where consistency across multiple documents is crucial, such as corporate templates or standardized reports.

Custom shadows become invaluable when working with brand guidelines that specify exact color values, positioning, or blur effects. Marketing teams often require precise shadow specifications to maintain visual identity across all collateral. Additionally, custom shadows allow for creative effects like multi-layered shadows or shadows that complement specific background colors.

What's the Basic Implementation Pattern?

Create a WordDocument, configure TextStyle with ShadowEffect, apply the style to your text, and save the document. The pattern remains consistent whether using presets or custom configurations.

:path=/static-assets/word/content-code-examples/how-to/text-effect-shadow-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()
{
    ShadowEffect = Shadow.OuterShadow1,
};

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

// Export new Word document
doc.SaveAs("shadowEffect.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 {.ShadowEffect = Shadow.OuterShadow1}

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

' Export new Word document
doc.SaveAs("shadowEffect.docx")
$vbLabelText   $csharpLabel
Microsoft Word document with 'Hello World' text displayed, showing Home ribbon with formatting tools

How Can I Customize Shadow Effect Properties?

Besides assigning a predefined shadow value, all of the shadow effect's properties can be configured. This provides a flexible option to customize the shadow effect in any way possible. See the properties and their descriptions below.

For teams evaluating licensing extensions or upgrades, custom shadow effects demonstrate IronWord's commitment to providing enterprise-grade document manipulation capabilities. The extensive customization options ensure that your investment in IronWord scales with your growing document processing needs.

Which Properties Control Shadow Positioning?

  • Alignment: Gets or sets the alignment of the shadow.
  • DirectionAngle: Gets or sets the direction angle of the shadow effect. The direction angle is specified in degrees.
  • DistanceFromText: Gets or sets the distance of the shadow effect from the text or object. The distance is specified in points (1/72 inch).

These positioning properties work together to create realistic shadow effects. The Alignment property determines the shadow's anchor point relative to the text, while DirectionAngle simulates the light source direction. DistanceFromText controls the perceived elevation of the text above the page surface. Combining these properties effectively creates shadows that appear to come from consistent light sources across your document.

What Properties Affect Shadow Appearance?

  • BlurRadius: Gets or sets the blur radius of the shadow effect. The blur radius is specified in points (1/72 inch).
  • SchemeColor: Gets or sets the scheme color of the shadow effect.

The appearance properties directly impact the visual quality of your shadows. BlurRadius creates soft or hard shadow edges—lower values produce crisp shadows suitable for technical documentation, while higher values create diffused shadows ideal for creative designs. SchemeColor allows you to match shadows to your document's color palette, maintaining visual consistency throughout your content.

How Do I Control Shadow Scaling and Skewing?

  • HorizontalScalingFactor: Gets or sets the horizontal scaling factor of the shadow effect.
  • HorizontalSkewAngle: Gets or sets the horizontal skew angle of the shadow effect. The skew angle is specified in degrees.
  • VerticalScalingFactor: Gets or sets the vertical scaling factor of the shadow effect.
  • VerticalSkewAngle: Gets or sets the vertical skew angle of the shadow effect. The skew angle is specified in degrees.

Scaling and skewing properties enable perspective effects that add dimensionality to your text. HorizontalScalingFactor and VerticalScalingFactor stretch or compress the shadow, creating effects that simulate different viewing angles. The skew angles allow you to create italic-like shadow effects or simulate shadows cast on angled surfaces, adding sophisticated visual depth to your documents.

What Are Common Property Value Ranges?

BlurRadius typically ranges from 0-10 points, DirectionAngle from 0-360 degrees, and scaling factors use percentage values (100 = normal size). DistanceFromText usually works best between 1-5 points for subtle effects.

Understanding these ranges helps achieve professional results quickly. For business documents, conservative values (BlurRadius: 2-4, DistanceFromText: 1-2) maintain readability while adding visual interest. Creative applications might push these boundaries with dramatic effects (BlurRadius: 8-10, DistanceFromText: 4-6) for impact. Remember that printer capabilities and screen resolution affect how shadows appear, so test your documents across intended output methods.

:path=/static-assets/word/content-code-examples/how-to/text-effect-customized-shadow-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()
{
    ShadowEffect = new Shadow()
    {
        Alignment = RectangleAlignmentValues.BottomLeft,
        BlurRadius = 5,
        DirectionAngle = 45,
        DistanceFromText = 3,
        HorizontalScalingFactor = 100,
        VerticalScalingFactor = 100,
        HorizontalSkewAngle = 0,
        SchemeColor = IronWord.Models.Color.Aqua,
        VerticalSkewAngle = 0,
    },
};

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

// Export new Word document
doc.SaveAs("customizedShadowEffect.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 {
	.ShadowEffect = New Shadow() With {
		.Alignment = RectangleAlignmentValues.BottomLeft,
		.BlurRadius = 5,
		.DirectionAngle = 45,
		.DistanceFromText = 3,
		.HorizontalScalingFactor = 100,
		.VerticalScalingFactor = 100,
		.HorizontalSkewAngle = 0,
		.SchemeColor = IronWord.Models.Color.Aqua,
		.VerticalSkewAngle = 0
	}
}

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

' Export new Word document
doc.SaveAs("customizedShadowEffect.docx")
$vbLabelText   $csharpLabel
Customized shadow effect

Frequently Asked Questions

How do I add a shadow effect to text in C# Word documents?

To add a shadow effect using IronWord, create a TextStyle object and populate its ShadowEffect property with a Shadow object. You can use preset shadows like OuterShadow1 or customize properties like blur, distance, and color. Then apply this style to your text when adding it to the document.

Can I apply a preset shadow effect quickly without customization?

Yes, IronWord provides preset shadow options for quick implementation. You can apply a shadow effect in just one line of code: new IronWord.WordDocument().AddText("Shadow!").Style = new IronWord.Models.TextStyle { TextEffect = new IronWord.Models.TextEffect { ShadowEffect = IronWord.Models.Shadow.OuterShadow1 } };

What shadow customization options are available?

IronWord allows you to customize various shadow properties including blur amount, distance from the text, color of the shadow, and offset positioning. This enables you to create unique shadow effects that match your branding requirements beyond the preset options.

Do I need a special license to use shadow effects?

Shadow effects are included in all IronWord license tiers. However, you need to properly configure your license keys to avoid watermarks in production documents when implementing text effects like shadows.

What are shadow effects useful for in Word documents?

Shadow effects in IronWord are particularly useful when creating professional documents, presentations, and reports where text needs to stand out. They add depth and visual distinction to text elements, making them ideal for automated reports, certificates, and branded documentation.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Ready to Get Started?
Nuget Downloads 28,054 | Version: 2025.12 just released