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 |
Why do you need to serialize
What are the types of assemblies and where can u store them and how ?
11 Answers Accenture, BirlaSoft, IBM,
What is a razor file?
How to bind table coloum with gridview column
3 Answers Sypher Technologies,
What are delegates?where are they used
What happens when I install the .net framework 3.0? How can I upgrade if I already have the .net framework 2.0 installed?
Which is the best institute in hyderabad to learn DotNet?
152 Answers Cygnet Infotech, Infosys, Student, SVIT, TCS,
what is the three pillar of .Net ?
What is CLR and how it generates native code ?
1 Answers Digital GlobalSoft, Vital Soft,
What are Satellite Assemblies? How you will create this?
mention what are the various methods provided by the dataset object to generate xml?
Difference between <connectionstring> and <appsettings>