Dodaj konspekt tekstu
Dodawanie efektów konturu tekstu
Efekty konturu tekstu poprawiają widoczność i styl tekstu poprzez rysowanie obramowania wokół każdego znaku. Efekt ten jest szczególnie przydatny do tworzenia pogrubionego, przyciągającego wzrok tekstu lub zapewnienia czytelności, gdy tekst pojawia się na obrazach lub kolorowym tle. IronWord provides the TextOutlineEffect class with preset configurations for quick implementation.
To apply a text outline, create a TextStyle object and configure its TextEffect property with TextOutlineEffect.DefaultEffect. Ten preset zapewnia standardową konfigurację schematu, która sprawdza się w większości scenariuszy. W przypadku niestandardowych konturów programiści mogą określać właściwości, takie jak szerokość konturu, kolor i styl linii, aby uzyskać określone efekty wizualne.
After setting up the text style, create a Run containing the desired TextContent and assign the configured style to the run's Style property. Use AddChild to add the styled run to a paragraph, then add the paragraph to the document. Takie uporządkowane podejście zapewnia prawidłowe formatowanie i zachowuje integralność dokumentu.
Wyjaśnienie kodu
Zastosowanie konspektu tekstu jest niezwykle proste dzięki IronWord. Pomimo swojej prostoty każdy atrybut konspektu tekstu można dostosować do wszelkich potrzeb. Once a Word document is imported, the textStyle is configured to include a text outline effect by assigning TextOutlineEffect.DefaultEffect to the TextOutlineEffect property of a new TextEffect instance.
To apply this effect to text, a Paragraph is created, then a Run object is created containing the desired TextContent. The configured textStyle is assigned to the Run, applying the text outline effect. The Run is added to the Paragraph using AddChild, and the Paragraph is added to the document. To odzwierciedla hierarchię dokumentu: Dokument → Akapit → Fragment tekstu → Zawartość tekstu. Na koniec dokument jest eksportowany.

