ComponentOne Word for WPF
Working with Word for WPF / Basic Level Working / Adding Text
In This Topic
    Adding Text
    In This Topic

    You can add text to a word document using C1Word. You need to write the desired text and use AddParagraph method to add text. You can also set other properties, such as font style, family, color, and more for the text to be displayed in the word document using Font class and its properties. The implementation of adding text to a word document is given in the code below:

    1. Create an object of C1WordDocument class with the following code:
      Dim word = New C1WordDocument()
      
      var word = new C1WordDocument();
                                      
      
    2. Write the following code to add text to the document:
      Dim text = "Hello!! This is a sample text."
      Dim font = New Font("Segoe UI Light", 20, RtfFontStyle.Italic)
      word.AddParagraph(text, font, Colors.BlueViolet, RtfHorizontalAlignment.Justify)
      
      var text = "Hello!! This is a sample text.";
      var font = new Font("Segoe UI Light", 20, RtfFontStyle.Italic);
      word.AddParagraph(text, font, Colors.BlueViolet, RtfHorizontalAlignment.Justify);
                                      
      

    The document will look similar to the image below: