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

What are the main components of .net framework?

0 Answers  


What is the difference b/w constant & read only variable?

4 Answers   IMI Soft Engineering,


what is split entity?

0 Answers   Microsoft,


How we can call a JavaScript function on the change of a Dropdown List in ASP.Net MVC?

0 Answers  


Explain covariance and contra-variance in .net framework 4.0. Give an example for each.

0 Answers  






mention what is the key advantage of using entity framework or ef?

0 Answers   Microsoft,


What are Scaffold templates in ASP.Net MVC?

0 Answers  


js fn to go to the particular page when enter is clicked

1 Answers  


Is any files are generated,when we are adding the web reference to the web service?

2 Answers  


What was the problem in traditional component why side by side execution is supported in .net ?

1 Answers   MMTS,


What is MVVM design pattern?

0 Answers  


What is shared and private assembly ?

3 Answers   Accenture, BirlaSoft,


Categories