How to Create a Microsoft Word Document with C#

object oMissing = System.Reflection.Missing.Value;

Microsoft.Office.Interop.Word.Application oWord;
oWord = new Microsoft.Office.Interop.Word.Application();
oWord.Visible = true;

Microsoft.Office.Interop.Word.Document oDoc;
oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);

// add text
Microsoft.Office.Interop.Word.Paragraph oPara1;
oPara1 = oDoc.Paragraphs.Add(ref oMissing);
object styleHeading1 = “Heading 1”;
oPara1.Range.set_Style(ref styleHeading1);
oPara1.Range.Text = “Create a New Report”;
oPara1.Range.InsertParagraphAfter();

Microsoft.Office.Interop.Word.Paragraph oPara2;
oPara2 = oDoc.Paragraphs.Add(ref oMissing);
oPara2.Range.Text = “”;
oPara2.Range.InsertParagraphAfter();

Microsoft.Office.Interop.Word.Paragraph oPara3;
oPara3 = oDoc.Paragraphs.Add(ref oMissing);
oPara3.Range.Text = “This is my second paragraph.”;
oPara3.Range.InsertParagraphAfter();

// add picture
string imgName = “c://tmp/doc1.jpg”;  //the picture file to be inserted
Object oMissed = oDoc.Paragraphs[2].Range; //the position you want to insert
Object oLinkToFile = false;  //default
Object oSaveWithDocument = true;//default
oDoc.InlineShapes.AddPicture(imgName, ref  oLinkToFile, ref  oSaveWithDocument, ref  oMissed);

// save
object fileName = “C:\\tmp\\test_report.doc”;
oDoc.SaveAs(ref fileName, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
oDoc.Close(ref oMissing, ref oMissing, ref oMissing);
oWord.Quit(ref oMissing, ref oMissing, ref oMissing);
oWord = null; // Free up any memory used

Word Object Model Overview
Ref: suite101.com