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. General Programming
  3. C#
  4. Byte array to word document

Byte array to word document

Scheduled Pinned Locked Moved C#
csharpsysadminmcpdata-structurestutorial
3 Posts 3 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.
  • T Offline
    T Offline
    Tauseef A
    wrote on last edited by
    #1

    hi guys i am working on a project which fetches emails from pop3 server , what i want to do is to read all email get all attachments (which ihave done) now i have attachemnt data in the form of a byte array , if there is a text attachment so this binary data can easily be converted to string to get the file data , but probelm is if there is docx file attchment than this binary data cannot be converted to string as it gives some raw data which is unreadable , can any body tell me how to convert a binary data (byte array )which is build based on a docx file back into string without saving the file on the hard disck. regards. Tauseef A Khan MCP Dotnet framework 2.0.

    B M 2 Replies Last reply
    0
    • T Tauseef A

      hi guys i am working on a project which fetches emails from pop3 server , what i want to do is to read all email get all attachments (which ihave done) now i have attachemnt data in the form of a byte array , if there is a text attachment so this binary data can easily be converted to string to get the file data , but probelm is if there is docx file attchment than this binary data cannot be converted to string as it gives some raw data which is unreadable , can any body tell me how to convert a binary data (byte array )which is build based on a docx file back into string without saving the file on the hard disck. regards. Tauseef A Khan MCP Dotnet framework 2.0.

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #2

      Use a pop3 client, e.g. "A C# Implementation of Mime De/encode"[^]. It will handle that for you. Edit: Thanks for downvoting without telling a reason.

      modified on Monday, October 25, 2010 5:39 AM

      1 Reply Last reply
      0
      • T Tauseef A

        hi guys i am working on a project which fetches emails from pop3 server , what i want to do is to read all email get all attachments (which ihave done) now i have attachemnt data in the form of a byte array , if there is a text attachment so this binary data can easily be converted to string to get the file data , but probelm is if there is docx file attchment than this binary data cannot be converted to string as it gives some raw data which is unreadable , can any body tell me how to convert a binary data (byte array )which is build based on a docx file back into string without saving the file on the hard disck. regards. Tauseef A Khan MCP Dotnet framework 2.0.

        M Offline
        M Offline
        Mirko1980
        wrote on last edited by
        #3

        You can use OpenXML SDK to parse your byte array (use WordprocessingDocument.Open with a MemoryStream). Then look here for hints on how get all text content of the Word Document.

        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