1,105,340 Community Members

Word Document into webpage with same style

Member Avatar
mostafa.m.mansy
Newbie Poster
1 post since Feb 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

hi
i want to display word file with same style using asp.net c#

here is code that display word file content without images ,tables ,etc......

      ApplicationClass wordApp = new ApplicationClass();

      object file = path;

      object nullobj = System.Reflection.Missing.Value;
      object format = true;

      Microsoft.Office.Interop.Word.Document doc = wordApp.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);



      doc.ActiveWindow.Selection.WholeStory();

      doc.ActiveWindow.Selection.Copy();

      string sFileText = doc.Content.Text;
      //string style = doc.

      doc.Close(ref nullobj, ref nullobj, ref nullobj);

      wordApp.Quit(ref nullobj, ref nullobj, ref nullobj);

      Response.Write(sFileText);

any idea to display

LastMitch
Deleted Member
 
0
 

i want to display word file with same style using asp.net c#

The code you provided is missing a few steps (I don't you can used the code because it's not going to work).

Read this link (it has an example on how to show the .doc file):

http://www.c-sharpcorner.com/UploadFile/scottlysle/WordinWeb01202007101216AM/WordinWeb.aspx

or this:

http://www.aspsnippets.com/Articles/Display-Word-document-on-web-page-in-ASP.Net.aspx

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article