Creating Word document using C#
Create a new windows application project and add a button to it.
On click of that button, we will create a new document(word) and write a simple Hello World text in it.
To create a word document using C# we need to first reference the following DLL(com)

After adding reference, add this directive
using Microsoft.Office.Interop.Word;
Put this code on button click
Say you want to insert a picture in a word document what you can do is
open the word document – Go to Tools ->Macro-> Record New Macro
Now click on insert menu and insert the picture. Stop the recording, again go to Macro -Macros-> Select your Macro and click on edit
You will find the vba code over there
Sub Macro1()
Selection.InlineShapes.AddPicture FileName:= _
“C:\Documents and Settings\nishantr1\My Documents\My Pictures\untitled.bmp” _
, LinkToFile:=False, SaveWithDocument:=True
End Sub
Now to write the same code in c# you will do something like this
Bye
This was originally posted here.

Like
Report
*This post is locked for comments