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 route table has been created in ASP.NET ASP.Net MVC?

0 Answers  


What are the levels at which filters can be applied in an asp.net mvc application?

0 Answers   NA,


In razor syntax, what is the escape sequence character for @ symbol?

0 Answers  


unit test done by tetser on development team?

3 Answers   Crea,


What is difference between Viewbag and Viewdata in ASP.NET MVC?

0 Answers   NA,


About Assembly in .NET, types of assemblies, their difference, How to register into GAC. How to generate the strong names & its use ?

6 Answers   Infosys, Microsoft, MMTS,


What is edm (entity data model)? : Entity framework

0 Answers  


How to create an alias name for a namespace?

4 Answers   IBM,


What is a razor file?

0 Answers  


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

1 Answers   MMTS,


give the feature of .net2.0 over .net1.1

6 Answers  


If Controller is not there in MVC Pattern what happens?

2 Answers  


Categories