Schattierungseffekt hinzufügen

Implementieren von Schatteneffekten auf Text

Schatteneffekte verleihen Texten Tiefe und Dimension, indem sie einen Schatten hinter den Zeichen erzeugen. IronWord provides predefined shadow presets through the Shadow class, offering various shadow styles that can be applied quickly without manual configuration.

To add a shadow effect, create a TextStyle and configure its TextEffect property with a shadow preset such as Shadow.OuterShadow1. These static named instances from the Shadow class provide professionally designed shadow configurations with appropriate blur, distance, and angle settings. Die Varianten mit äußerem Schatten projizieren den Schatten vom Text weg und erzeugen so einen erhabenen Eindruck.

Once the text style is configured with the desired shadow effect, create a Run object containing TextContent and assign the style to the run. Add the styled run to a paragraph using AddChild, then include the paragraph in the document. Dieser Ansatz orientiert sich an der Dokumenthierarchie von IronWord und stellt sicher, dass der Schatteneffekt korrekt auf die Ausgabedatei angewendet wird.

Code Erklärung

Ein Schatteneffekt kann mit nur wenigen Codezeilen zu Text in einem Word-Dokument hinzugefügt werden. For completeness, let's first initialize a new WordDocument instance called doc. Then, a TextStyle object is created and configured to incorporate a shadow effect by assigning the Shadow.OuterShadow1 static named instance to the TextEffect property.

To add the styled text with the shadow effect, 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 shadow effect. The Run is added to the Paragraph using AddChild, and the Paragraph is added to the document. Dies folgt der Dokumenthierarchie: Dokument → Absatz → Textabschnitt → Textinhalt. Schließlich exportieren Sie das Word-Dokument.

Für weitere Beispiele und Demonstrationen navigieren Sie bitte zum folgenden Artikel: So fügen Sie einen Schatteneffekt zu Text hinzu

Erkunden Sie Dokumentelemente mit den IronWord-Tutorials.

Bereit anzufangen?
Nuget Downloads 36,374 | Version: 2026.3 gerade veröffentlicht
Still Scrolling Icon

Scrollst du immer noch?

Sie brauchen schnell einen Beweis? PM > Install-Package IronWord
Führen Sie ein Beispiel aus und sehen Sie zu, wie aus Ihren Daten ein Word-Dokument wird.