Click here to Skip to main content
16,016,925 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,,

I am working on an Word 2007 add-in,I want this add-in to get the whole content of this active word document and convert it to array of bytes without saving the document in the filestream.
I have succeeded in getting the text in this document and convert it to an array of bytes without saving the document,but that is not enough.

So as a summary of my issuess:
1. I want to get the whole content (text,image..etc)in this active word document and convert it to an array of bytes.
2. I want the format of this document content to be preserved when I convert it to an array of bytes.Because later on I will get this content(as an array of bytes)back and convert to its original.
The document content in stored in a database.

I hope I explained my problem clear enough,I'd appreciate it if anyone can help me with it.

Thank you in advance,,
:)
Posted

1 solution

To get whole Content in word document. Please see the Code Below
C#
Application wordApp = new ApplicationClass();
 Document doc = null;

 // path where word File is uploaded
 public string file_Name = "GeekGirl.doc";
  object uploadFilePath="C:\FolderName" +file_Name ;

           object missing = System.Reflection.Missing.Value;
             object setFalse = false;
             object saveChanges = WdSaveOptions.wdSaveChanges;
             object setTrue = true;
             doc = wordApp.Documents.Open( ref uploadFilePath
             ref setFalse, ref setFalse, ref setFalse, ref missing,
             ref missing, ref setTrue, ref missing, ref missing,
             ref missing, ref missing, ref setFalse, ref setFalse,
             ref missing, ref setTrue, ref missing);
 
Share this answer
 
Comments
Afnan_ 19-Mar-12 4:34am    
Thank you for your reply,
But "GeekGirl.doc" does it already exist?Because you used the open method.
If so,then that might help,but what I need is to work on the current document content and not something saved.I don't wnat to save it in the filestream.
Soumya Joseph 19-Mar-12 4:38am    
Hi Afnan,
"GeekGirl.doc" is the name of the existing Word doc .

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