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

Is there built-in support for tracing/logging

1 Answers  


What is meant by bootstrap in mvc5?

0 Answers  


please tell me the best book of asp.net in the markit. which explain in simple and detail.

4 Answers  


exe abrevatiom

5 Answers   IBM,


What is the use of JIT

1 Answers  






Can we create the web service in windows application?

3 Answers  


How do you do role based security ?

1 Answers   Accenture, BirlaSoft,


What are the methods in Thread class?

3 Answers  


How to create an alias name for a namespace?

4 Answers   IBM,


What are the 3 segments of the default route, that is present in an ASP.NET MVC application?

0 Answers   NA,


Can you set the unlimited length for "maxjsonlength" property in config?

0 Answers  


What is action methods in web api?

0 Answers  


Categories