Add Gradient Effect Applying Gradient Effects to Text The gradient effect in IronWord allows text to display color transitions, creating visually appealing designs. IronWord provides preset gradient options through the Gradient class, such as Gradient.DefaultGray, which can be assigned directly to the GradientEffect property of a TextEffect. To apply a gradient, create a TextStyle object and configure its TextEffect property with a GradientEffect. The gradient can be set using predefined static instances from the Gradient class, which offer commonly used color schemes and transitions. These presets simplify the process of adding professional-looking gradients without manually configuring color stops. Once the style is configured, create a Run containing TextContent and assign the style to the run's Style property. Add the run to a paragraph using AddChild, then insert the paragraph into the document. This structured approach ensures the gradient effect is properly applied and preserved in the output document. Code Explanation The above code demonstrates how to apply a gradient effect to text. First, it creates a new Word document. Then, it creates a TextStyle object and configures it to use a gradient effect by assigning the Gradient.DefaultGray preset to the GradientEffect property. To add the styled text, 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 gradient 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, the new Word document is exported. For more examples and demonstrations, please navigate to the following article: How to Add Gradient Effect to Text. Explore More Word Document Element Tutorials Here Related Docs Links View on Github Related Tutorial Related How-To Guide Class Documentation Download IronWord DLL Report an Issue on this page Ready to Get Started? Nuget Downloads 33,665 | Version: 2026.3 just released Start Free Trial Free NuGet Download Total downloads: 33,665 View Licenses
All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)