Opening doc file and Printing the Content in Label Box

Posted by Somasundaram under ASP.NET on 6/20/2012 | Points: 10 | Views : 1125 | Status : [Member] | Replies : 1
Hi..,

I need to read a Doc or docx file and Bind the content of file in Label Box

This is the Code i used and got output.


object Unknown = Type.Missing;
string strTemp = "";
string strFile = string.Empty;
strFile = this.trFileView.SelectedNode.Text.ToString();
object FileName = Server.MapPath(strFile);
ApplicationClass wordApp = new ApplicationClass();
object file = FileName;
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);
lblText.Text = sFileText;


when i host this application into IIS Server I get error.


Server Error in '/KMS' Application.

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a.


Can any one Solve this problem and also say What are the requirement needed to Host into IIS Server.


Regards,
Somasundaram




Responses

Posted by: Ajay.Kalol on: 6/21/2012 [Member] Starter | Points: 25

Up
0
Down
http://ajaypatelfromsanthal.blogspot.in/2012/05/read-text-file-from-javascript.html



Here is example to read text file from JavaScript. refer it.

Ajay
ajaypatelfromsanthal.blogspot.in

Somasundaram, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response