Click here to Skip to main content
15,896,408 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i have a problem in reading and displaying doc file using asp.net.i need to display that doc file content in my webpage.
here is my code:


Object filename = (Object)wordFile.FullName;
Document doc = word.Documents.Open(ref filename, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing);


try
{
doc.Activate();

doc.ActiveWindow.Selection.WholeStory();
doc.ActiveWindow.Selection.Copy();
object emptyData = string.Empty;


IDataObject data = System.Windows.Forms.Clipboard.GetDataObject();
String filetext = data.GetData(System.Windows.Forms.DataFormats.Text).ToString();
System.Windows.Forms.Clipboard.SetDataObject(string.Empty);
RichTextBox richTextBox1 = new RichTextBox();
richTextBox1.Text = filetext;



my doc file contains text as well as image.i dont know how to read and display this doc file in my webpage.please help me.
Posted
Updated 16-Apr-12 3:31am
v2

1 solution

hi.... just u need to save the file in root directory of your project.

then give the that file path.. it will disply..
string path="~/filename";
response.redirect("path");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900