Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi sir,

i want fetch the Ms word document content into text box in asp.net,

am done such things ,is working completely in local

but after uploaded server not showing ,the text box is empty

please give the solution

because it is urgent requirement.

By
Nandakumar.S
Posted
Comments
Prasad_Kulkarni 7-May-12 2:39am    
can you post your code snippet?
Sandeep Mewara 7-May-12 2:45am    
It's too difficult to comment anything based on what you have shared. Did you debug? what was found? Elaborate on the issue.
Nandakumar31 7-May-12 2:59am    
yeah, debugged but no errors or message found just show empty textbox showing,
but locally run clearly.
Dhanamanikandan 7-May-12 3:41am    
Plz share your code to help you!
Nandakumar31 7-May-12 3:45am    
msWord.ApplicationClass oWord = new msWord.ApplicationClass();
object nullobj = System.Reflection.Missing.Value;
string location = Server.MapPath("~") + "\\Resumes\\";
object file = location.Trim() + resume.Trim(); //"D:/Folder1/1.doc"; //location; // @"D:\DOT NET\sanvelsinfo\Resumes\SVCM-00002.doc";
Word.Document oWordDoc = (Word.Document)(oWord.Documents.Add(ref file, ref nullobj, ref nullobj, ref nullobj));
str = oWordDoc.Content.Text;
if (str.ToLower().Contains(keyword) || str.ToUpper().Contains(keyword))
{
filename = resume.Trim();
filename = filename.Replace(".doc", "");
filename = filename + ",";
lbl_resume.Text = str.ToString();
uid = lbl_uid.Text;
Total_file += filename.ToString();
}
oWord.Quit(ref nullobj, ref nullobj, ref nullobj);

this code run only locally

not showing after uploaded in server

1 solution

Try this
C#
using (System.IO.StreamReader sr = new System.IO.StreamReader("TestFile.txt"))
{
TextBox1.Text = sr.ReadToEnd();
}
 
Share this answer
 
Comments
Nandakumar31 7-May-12 9:27am    
hi sir

when i used this above stream reader, show the content with unwanted symbols before the and after the text

am tried some other functions like sr.read(), sr.Tostring(),sr.ReadLine(),

but not erased

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900