Ajouter du texte stylisé The "Add Style Text" feature in IronWord allows developers to apply various text styling options while adding content to a DOCX document. It provides fine-grained control over the appearance of text, such as specifying the font family, size, color, and style attributes like bold, italic, underline, and strike-through. By creating a Text object and configuring its TextStyle, developers can tailor the presentation of individual text elements within a document, ensuring a customized look and feel. This feature is useful for generating professionally formatted documents dynamically, such as reports or letters, where specific sections require distinct styles. The TextStyle class enables easy manipulation of these attributes, allowing for both simple and complex styling within the same document. 5 Steps to Add Styled Text to a DOCX This code shows how to create and style text in a DOCX document using IronWord. It begins by initializing a new WordDocument object, representing the document to be generated. A Text object is created with the string "Styled text example" and a TextStyle is applied to configure the appearance of the text. The TextStyle includes settings for the font family (Arial), font size (14), text color (blue), and bold formatting, which customize how the text will appear in the final document. After the text is styled, the AddText method adds the Text object to the document. This method inserts the styled content into the Word document in the appropriate format. Finally, the SaveAs method is called to export the document as "styled_document.docx". The result is a Word document where the inserted text is formatted according to the specified styles, preserving all font and formatting properties in the output file. Explore Document Element Tutorials for More Styling Tips Liens de documentation associés Voir sur Github Tutoriel connexe Guide pratique connexe Documentation de classe Télécharger IronWord DLL Signaler un problème sur cette page Prêt à commencer? Nuget Téléchargements 25,807 | Version : 2025.11 vient de sortir Téléchargement gratuit NuGet Total des téléchargements :25,807 Voir Licences
Testez dans un environnement en direct Testez en production sans filigranes.Fonctionne où que vous en ayez besoin.
Produit entièrement fonctionnel Profitez de 30 jours de produit entièrement fonctionnel.Configurez-le et faites-le fonctionner en quelques minutes.
Testez dans un environnement en direct Testez en production sans filigranes.Fonctionne où que vous en ayez besoin.
Produit entièrement fonctionnel Profitez de 30 jours de produit entièrement fonctionnel.Configurez-le et faites-le fonctionner en quelques minutes.