Quick Start: Word for WinForms > Step 2 of 3: Adding Simple Text |
While you are still in code view, add the following lines of code beneath the InitializeComponent() method to create a Word document using C1Word component:
' create document Dim c1Word As New C1WordDocument() c1Word.Info.Title = "Simple Text Sample" Dim font As New Font("Cambria", 24, FontStyle.Bold) c1Word.AddParagraph("Hello! This is a C1Word component simple text example.", font, Color.MediumPurple) c1Word.Save("simple.docx") Process.Start("simple.docx")
// create document C1WordDocument c1Word = new C1WordDocument(); c1Word.Info.Title = "Simple Text Sample"; Font font = new Font("Cambria", 24, FontStyle.Bold); c1Word.AddParagraph("Hello! This is a C1Word component simple text example.", font, Color.MediumPurple); c1Word.Save("Simple.docx"); Process.Start("Simple.docx");
In the above code, a word document with Simple Text Sample title is created and some text is added to it using AddParagraph method. Lastly, the document is saved with the name, Simple.docx.