Ajouter un effet de lueur

Ajouter un effet de lueur au texte

Applying a glow effect to text in IronWord is accomplished by configuring the TextEffect property of a TextStyle object. L'effet de halo crée une bordure lumineuse autour du texte, avec des propriétés de couleur et de rayon personnalisables pour contrôler l'apparence visuelle.

To create a glow effect, instantiate a TextStyle and assign a TextEffect object with a configured Glow instance. The Glow object accepts properties like GlowColor to specify the color of the glow and GlowRadius to control the spread of the effect. Des valeurs de rayon plus élevées produisent des halos plus diffus, tandis que des valeurs plus faibles créent des halos plus resserrés autour du texte.

After configuring the text style, create a Run object containing the desired TextContent and assign the configured style to the Run. Use AddChild to add the styled run to a paragraph, then add the paragraph to the document. Cela suit la hiérarchie du document : Document → Paragraphe → Run → TextContent.

Explication du code

L'extrait de code ci-dessus montre comment créer un nouveau document Word et appliquer un style de texte avec un effet de halo. First, a new Word document is instantiated and stored in the variable doc. Then, a new TextStyle object named textStyle is created. This text style is configured to include a glow effect by initializing a TextEffect object with specific settings.

To add the styled text with the glow effect, a Paragraph is created, then a Run object is created containing TextContent with "Hello World". The textStyle is assigned to the Run, which applies the glow effect. The Run is added to the Paragraph using AddChild, and finally the Paragraph is added to the document. Cette approche en plusieurs étapes suit la hiérarchie du document : Document → Paragraphe → Run → TextContent. Enfin, le document Word est exporté en tant que nouveau fichier.

Pour plus d'exemples et de démonstrations, veuillez consulter l'article suivant : Comment ajouter un effet de lueur au texte .

Apprenez-en davantage sur les éléments de document dans IronWord

Prêt à commencer?
Nuget Téléchargements 35,581 | Version : 2026.3 vient de sortir
Still Scrolling Icon

Vous faites encore défiler ?

Vous voulez une preuve rapidement ? PM > Install-Package IronWord
exécuter un échantillon regarder vos données devenir un document Word.