Dodaj efekt rozbłysku

Dodawanie efektu poświaty do tekstu

Applying a glow effect to text in IronWord is accomplished by configuring the TextEffect property of a TextStyle object. Efekt poświaty tworzy świecącą obwódkę wokół tekstu, z możliwością dostosowania koloru i promienia w celu kontrolowania wyglądu wizualnego.

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. Wyższe wartości promienia tworzą bardziej rozproszone poświaty, podczas gdy niższe wartości tworzą ciaśniejsze aureole wokół tekstu.

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. To odzwierciedla hierarchię dokumentu: Dokument → Akapit → Fragment tekstu → Zawartość tekstu.

Wyjaśnienie kodu

Powyższy fragment kodu pokazuje, jak utworzyć nowy dokument Word i zastosować styl tekstu z efektem poświaty. 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. To wieloetapowe podejście odzwierciedla hierarchię dokumentu: Dokument → Akapit → Fragment tekstu → Zawartość tekstu. Na koniec dokument Word jest eksportowany jako nowy plik.

Więcej przykładów i demonstracji można znaleźć w poniższym artykułe: Jak dodać efekt poświaty do tekstu.

Dowiedz się więcej o elementach dokumentu w IronWord

Gotowy, aby rozpocząć?
Nuget Pliki do pobrania 44,829 | Wersja: 2026.5 just released
Still Scrolling Icon

Wciąż przewijasz?

Czy chcesz szybko dowodu? PM > Install-Package IronWord
uruchom próbkę zobacz, jak twoje dane stają się dokumentem Word.