How to open Microsoft Word from C#.net
Using this package
using Word = Microsoft.Office.Interop.Word;
private void button2_Click(object sender, EventArgs e)
{
object oMissing = System.Reflection.Missing.Value;
object oEndOfDoc = “\\endofdoc”; /* \endofdoc is a predefined bookmark */
object filename = @”E:/lakshmanan.docx”;
//Start Word and create a new document.
Word._Application oWord;
Word._Document oDoc;
oWord = new Word.Application();
oWord.Visible = true;
oDoc = oWord.Documents.Add(ref filename , ref oMissing,
ref oMissing, ref oMissing);
//doc.Open()= “E:/lakshmanan.doc”;
Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
//Insert a paragraph at the beginning of the document.
Word.Paragraph oPara1;
oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing );
oPara1.Range.Text = “MANIVANNAN”;
oPara1.Range.Font.Bold = 1;
oPara1.Range.Font.Size = 14;
//24 pt spacing after paragraph.
}