static void Main(string[] args)
{
//Create a word object that we can manipulate
Word.Application Word_app=new Word.Application();
Word.Document Word_doc=new Word.Document();
//Make Word Application Form visible.
Word_app.Visible=true;
Word.Documents docs=Word_app.Documents;
//open a exist word document.
object template="c:\\temp\\test.dot";
object missing=Type.Missing;
Word_doc=docs.Add(ref template,ref missing,ref missing,ref missing);
// define the selection object, find and replace text
Word.Window myWindow = Word_app.ActiveWindow;
Word.Selection mySelection = myWindow.Selection;
Word.Find myFind = mySelection.Find;
object findText = "alow";
object replaceText ="allow";
//count how many words in your document.
int intEnd=Word_doc.Words.Count; //Define a range to be read to byte[].
object start=0;
object end=intEnd;
Word.Range range=Word_doc.Range(ref start,ref end);
string strText=range.Text;
byte[] buffer=new byte[10000];
//Encoding.ASCII.GetBytes(strText,0,.Length,buffer,0);
Encoding.ASCII.GetBytes(strText,0,strText.Length,buffer,0);
}