using Microsoft.Office.Interop.Word;
//fuction private void readFileContent(string path) { ApplicationClass wordApp = new ApplicationClass(); object file = path; object nullobj = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Open( ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj); doc.ActiveWindow.Selection.WholeStory(); doc.ActiveWindow.Selection.Copy(); string sFileText = doc.Content.Text; doc.Close(ref nullobj, ref nullobj, ref nullobj); wordApp.Quit(ref nullobj, ref nullobj, ref nullobj); Response.Write(sFileText); }
No comments:
Post a Comment