Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to read the conents of word file on web page [modified]

how to read the conents of word file on web page [modified]

Scheduled Pinned Locked Moved ASP.NET
sysadmintutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    raghvendrapanda
    wrote on last edited by
    #1

    hy, can any one tell me that how can i read the contents of a MS word(.doc) file on a webpage(.aspx page). i tried to use filestream but whenevr i run it..i get a option to open or download the doc file which resluts in opening the word file but not the content of the word file on the web page. the code that i used was Response.ContentType = "application/ms-word"; Response.AddHeader("content-disposition", "attachment; filename=SFA & CRM.doc"); string a = Server.MapPath("SFA & CRM.doc"); FileStream sourceFile = new FileStream(a, FileMode.Open); long FileSize; FileSize = sourceFile.Length; byte[] getContent = new byte[(int)FileSize]; sourceFile.Read(getContent, 0, (int)sourceFile.Length); sourceFile.Close(); Response.BinaryWrite(getContent); plz helpl me out.. regards

    modified on Friday, October 10, 2008 4:00 AM

    J 1 Reply Last reply
    0
    • R raghvendrapanda

      hy, can any one tell me that how can i read the contents of a MS word(.doc) file on a webpage(.aspx page). i tried to use filestream but whenevr i run it..i get a option to open or download the doc file which resluts in opening the word file but not the content of the word file on the web page. the code that i used was Response.ContentType = "application/ms-word"; Response.AddHeader("content-disposition", "attachment; filename=SFA & CRM.doc"); string a = Server.MapPath("SFA & CRM.doc"); FileStream sourceFile = new FileStream(a, FileMode.Open); long FileSize; FileSize = sourceFile.Length; byte[] getContent = new byte[(int)FileSize]; sourceFile.Read(getContent, 0, (int)sourceFile.Length); sourceFile.Close(); Response.BinaryWrite(getContent); plz helpl me out.. regards

      modified on Friday, October 10, 2008 4:00 AM

      J Offline
      J Offline
      John_Adams
      wrote on last edited by
      #2

      Hi, Please know that Word .doc files are in a proprietary Microsoft binary format. They can only be interpreted correctly by the Office Word engine or a third party control suited for this purpose. You may consider using the Office PIA (Primary Interop Assemblies), automate Word and open the document in it, and extract the relevant portions from the same, preserving the formatting. Hope this helps.

      Regards, John Adams ComponentOne LLC

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups