| Author: Vidhya 22 Jul 2008 | Member Level: Gold | Rating: Points: 1 |
protected void Submit1_ServerClick(object sender, EventArgs e) {
Word.ApplicationClass wordApp = new Word.ApplicationClass();
<!--[if !supportEmptyParas]-->
// Input box is used to get the path of the file which ahas to be <!--[if !supportEmptyParas]-->uploaded into textbox.<!--[endif]-->
string filePath = inputbox.Value;
object<!--[if !supportEmptyParas]--> file = filePath; <!--[endif]-->
object nullobj = System.Reflection.Missing<!--[if !supportEmptyParas]-->.Value;<!--[endif]-->
<!--[if !supportEmptyParas]-->// here on Document.Open there should be 9 arg.<!--[endif]-->
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);<!--[if !supportEmptyParas]--> <!--[endif]-->
// Here the word content is copeied into a string which helps to store it into textbox.
Word.Document doc1 = wordApp.ActiveDocument;
string<!--[if !supportEmptyParas]--> m_Content = doc1.Content.Text;<!--[endif]-->
<!--[if !supportEmptyParas]-->// the content is stored into the textbox. <!--[endif]-->
m_Textbox.Text = m_Content;
doc.Close(ref nullobj, ref nullobj, ref nullobj); }
|