Byte array to word document
-
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.
-
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.
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
-
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.
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.