reading doc file in textbox using .net2005 with c#
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Which is the base class for .net Class library?
What is the difference between old ADO.NET and Entity framework coding techniques?
What is "out" parameter how it is used in methods?
Is it possible to combine asp.net webforms and asp.mvc and develop a single web application?
What are differences between entity framework and l2s? : Entity framework
Why is XmlSerializer so slow
What are the main features of asp.net mvc 4 used by asp.net web api?
which is good java or Dot net?
What is stateless model?
Can you Write the GC(Garbage Collector) Algoritham in .NET? (But not Explination of Working of GC).
What is the advantage of using asp.net routing?
Name a few different return types of a controller action method?