reading doc file in textbox using .net2005 with c#

Answers were Sorted based on User's Feedback



reading doc file in textbox using .net2005 with c#..

Answer / anand

ApplicationClass WordOper = new ApplicationClass();
String filePath = Server.MapPath("../Files/Book.doc");
Object file = filePath;
object nullobj = System.Reflection.Missing.Value;
Document doc = WordOper.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);
Document doc1 = WordOper.ActiveDocument;
string m_Content = doc1.Content.Text;
TextBox1.Text = m_Content;
doc.Close(ref nullobj, ref nullobj, ref nullobj);

Is This Answer Correct ?    3 Yes 2 No

reading doc file in textbox using .net2005 with c#..

Answer / sachin

we have to add referance of word document from COM
referance..
because it only work with .txt files..

Is This Answer Correct ?    4 Yes 6 No

reading doc file in textbox using .net2005 with c#..

Answer / tiger skumar

We can use the files concept to load the doc file content
into the textbox using the Multiline property.

we have many ways.This is one of the way.

using System.IO;


FileStream fstream = new
FileStream("Sample.doc",FileMode.Open,FileAccess.Read);
StreamReader sreader = new StreamReader(fstream);

txtFileContent.Text = sreader.ReadToEnd();


->change your Text Box Property into tghe multilien txtbox.

Is This Answer Correct ?    5 Yes 16 No

Post New Answer

More Dot Net Framework Interview Questions

How to return the JSON from action method in ASP.Net MVC?

0 Answers  


What are delegates?where are they used

1 Answers  


Why we need a separate mobile project template, while we can render our web application in mobile ?

0 Answers  


Microsoft introduced c# as a de facto language of the .NET platform. What is mean by de facto and fot what purpose? Please answer me. Advance thanks.

3 Answers   Excel,


What is orm entity framework?

0 Answers  






What is Globalizationa and Localization

1 Answers  


What is Peek method in Tempdata in ASP.Net MVC?

0 Answers  


What is mapping in entity framework? : Entity framework

0 Answers  


If I have multiple filters implemented, what is the order in which these filters get executed?

0 Answers  


can we change the page layout in ASP.NET 2.0 as grid layout like in the previous version?

1 Answers   TCS,


Can I add mvc testcases in visual studio express?

0 Answers  


what is Assemble

4 Answers   Microsoft,


Categories