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

    You can add text to a word document using Word for UWP. 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 As New C1WordDocument()
      
      C1WordDocument 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)
      WordUtils.Save(word)
      
      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);
      WordUtils.Save(word);
      

    The document will look similar to the image below: