Using Spire.doc Generate Report As Word Document Without Utilizing Microsoft Word

We will create a windows application to demonstrate how to generate word doc as a report (Certificate) using library.
Spire.Doc for .NET is a library for developers to create, read, write, convert and print Word document files from C#, VB.NET, ASP.NET with quality performance.
Step 1: Create Windows Form Application, go to File - New Project, Windows, then Windows Forms Application, give a name 'WinSpiredoc' and click 'Ok'.
This will create a Windows form application as in the following screenshot, 
Step 2 : Create a layout by drag and drop Button control on form.
Step 3 : Change button text property and give a name 'Generate Certificate'.
Step 4: Add the reference dll of Spire.Doc.dll in your project, this is the dll using the class and methods we are going  to generate word document.
Step 5: Include Spire.Doc and Spire.Doc.Document  reference in your Form.cs file. For downloading and using Spire.Doc please click here.
Step 6: Now add the following code on your button click event. Here we are creating document object, and for that load a document first, then we will append the text paragraph, and lastly we will save doc file and launch the MS Word file.
  1. private void button1_Click(object sender, EventArgs e)   
  2. {  
  3.     //Create word document    
  4.     Document document = new Document();  
  6.     //load a document    
  7.     document.LoadFromFile(@ "D:\Ankur\PROJECTS\My Blogs\certificate.txt");  
  9.     //Get a paragraph    
  10.     Paragraph paragraph = document.Sections[0].AddParagraph();  
  12.     //Append Text    
  13.     paragraph.AppendText("This is to certify that Mr / Ms._____________________,has successfully completed his ______________________________ study with specialisation in _____________at XYZ University.");  
  16.     //Save doc file.    
  17.     document.SaveToFile("Sample.doc", FileFormat.Doc);  
  19.     //Launching the MS Word file.    
  20.     WordDocViewer("Sample.doc");  
  21. }   
  1. private void WordDocViewer(string fileName)    
  2.       {    
  3.           try    
  4.           {    
  5.               System.Diagnostics.Process.Start(fileName);    
  6.           }    
  7.           catch { }    
  8.       }  
Step 7: Now run the application and click on 'Generate Certificate' Button.
Step 8: This will open a word doc file with the paragraph you have added in code.
You can create invoice, certificates, bills, etc dynamically using this without utilizing Microsoft Word.
So, using Spire.Doc you can generate, modify, convert, render and print documents without utilizing Microsoft Word®.
But you need MS Word viewer to view the resultant document. 
Hope you like this article.