IronWord 操作指南 文本上的阴影效果 How to Add Shadow Effect to Text Curtis Chau 已更新:六月 9, 2025 Download IronWord NuGet 下载 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article This article was translated from English: Does it need improvement? Translated View the article in English 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. 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. Ideal for devs who want results fast with minimal setup. Get started making PDFs with NuGet now: Install IronWord with NuGet Package Manager PM > Install-Package IronWord 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 } }; Deploy to test on your live environment Start using IronWord in your project today with a free trial Free 30 day Trial Minimal Workflow (5 steps) Download a C# library to add a shadow effect to text Apply the text effect to either newly created or existing text Apply a preset shadow effect using the static named instance of the Shadow class Configure the Shadow properties to achieve a customized shadow Export the edited Word document as a new file Add Shadow Effect 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. :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 Shadow Effect Properties Besides assigning a predefined shadow value, all of the shadow effect's properties can be configured. This provides a very flexible option to customize the shadow effect in any way possible. Please see the properties and their descriptions below: Alignment: Gets or sets the alignment of the shadow. BlurRadius: Gets or sets the blur radius of the shadow effect. The blur radius is specified in points (1/72 inch). 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). 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. SchemeColor: Gets or sets the scheme color of the shadow effect. 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. :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 常见问题解答 如何在 C# 中向文本添加阴影效果? 您可以使用 IronWord 库在 C# 中为文本添加阴影效果。首先,下载该库,然后使用Shadow类应用阴影效果。根据需要配置属性并将应用效果的文档导出。 IronWord 中阴影效果的可自定义属性是什么? IronWord 允许您自定义阴影效果的多个属性,包括Alignment、BlurRadius、DirectionAngle、DistanceFromText、HorizontalScalingFactor、HorizontalSkewAngle、SchemeColor、VerticalScalingFactor 和VerticalSkewAngle。 如何使用 IronWord 应用预设阴影效果? 要使用 IronWord 应用预设阴影效果,请使用Shadow类的静态命名实例,并配置其属性以满足您的需求。 我可以为 Word 文档中的现有文本应用阴影效果吗? 是的,您可以通过创建TextStyle对象并用Shadow对象填充ShadowEffect属性,为 Word 文档中的新创建文本和现有文本应用阴影效果。 BlurRadius 属性在阴影效果中有什么作用? 阴影效果中的BlurRadius属性指定模糊半径,以点(1/72 英寸)为单位,决定阴影的软化或锐化程度。 如何控制 Word 文档中阴影效果的方向? 要控制 IronWord 中阴影效果的方向,请设置以度数为单位的DirectionAngle属性,以便按需定位阴影。 阴影可以与文本对齐不同吗? 是的,IronWord 的Alignment属性允许您设置阴影相对于文本的对齐方式,从而灵活定位阴影。 如何设置阴影效果的颜色以匹配文档主题? 使用 IronWord 中的SchemeColor属性设置阴影效果的颜色方案,使阴影匹配文档的整体设计主题。 DistanceFromText 属性在阴影效果中控制什么? DistanceFromText 属性控制阴影与文本或对象的距离,以点(1/72 英寸)为单位,影响阴影与文本的距离。 Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 准备开始了吗? Nuget 下载 25,807 | 版本: 2025.11 刚刚发布 免费 NuGet 下载 总下载量:25,807 查看许可证