IronWord 操作指南 文字上的反射效果 How to Add Reflection Effect to Text Curtis Chau 更新日期:6月 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 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. 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("Quick Text").Style = new IronWord.Models.TextStyle(){ TextEffect = new IronWord.Models.TextEffect(){ ReflectionEffect = new IronWord.Models.Reflection() } }; 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 reflection to text. Apply the text effect to either newly created or existing text. Apply a preset reflection effect by instantiating the Reflection class. Configure the Reflection properties to achieve a customized text outline. Export the edited Word document as a new file. 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 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 常見問題解答 如何使用 C# 對 Word 文件中的文字添加反射效果? 您可以通過下載 IronWord 庫來使用 C# 對 Word 文件中的文字添加反射效果。首先創建一個 `TextStyle` 對象,將其 `ReflectionEffect` 屬性填充 `Reflection` 對象,並按您的喜好自定義這些屬性。最後,匯出已應用反射效果的 Word 文件。 在 IronWord 中,可調整的反射效果有哪些屬性? 在 IronWord 中,您可以調整屬性,例如 `SchemeColor`、`HorizontalSkewAngle`、`HorizontalScalingFactor`、`DistanceFromText`、`DirectionAngle`、`FadeDirectionAngle`、`EndPosition`、`StartPosition`、`EndingOpacity`、`VerticalScalingFactor`、`StartingOpacity`、`Alignment`、`BlurRadius` 和 `VerticalSkewAngle` 以自訂反射效果。 如何自訂反射效果與文字之間的距離? 在 IronWord 中,使用 `DistanceFromText` 屬性來設置反射效果與文字之間的距離。此距離以點 (1/72 英吋) 為單位,讓您可以控制反射從原始文字開始的距離。 我可以調整 IronWord 中反射效果的透明度嗎? 是的,可以通過使用 IronWord 中的 `StartingOpacity` 和 `EndingOpacity` 屬性來自訂反射效果的透明度。這些屬性允許您定義反射從哪裡開始和結束的透明度,讓您能夠控制其視覺呈現。 `HorizontalSkewAngle` 在反射效果中的作用是什麼? IronWord 中的 `HorizontalSkewAngle` 屬性設定反射效果的水平傾斜角。此屬性以度數指定,通過水平傾斜反射來改變其外觀。 如何在 C# 中開始為文字添加反射效果? 首先下載 IronWord 庫。接著創建一個 `TextStyle` 對象,並把 `ReflectionEffect` 屬性填入一個 `Reflection` 對象。使用可用的屬性來自訂效果並應用到您的文字中。 在 IronWord 中可以調整反射效果的模糊度嗎? 是的,您可以通過設定 `BlurRadius` 屬性來調整 IronWord 中反射效果的模糊度。此值以點 (1/72 英吋) 為單位,讓您可以控制反射的柔和度。 Curtis Chau 立即與工程團隊聊天 技術作家 Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。 準備好開始了嗎? Nuget 下載 25,807 | 版本: 2025.11 剛剛發布 免費 NuGet 下載 總下載量:25,807 查看許可證