By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,570 Members | 970 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,570 IT Pros & Developers. It's quick & easy.

Extract embedded documents in the word document

P: 1
Hi,

I have a word document that has attached(ie. embedded ) documents like word, ppt, pdf, etc.

I have to extract those embedded documents in the document through code.



To extract embedded word document. I used the following code.



word = new Microsoft.Office.Interop.Word.Application();



doc = word.Documents.Open(ref fileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);

doc.Activate();

int attachmentsCount = doc.InlineShapes.Count;

for (int i = 0; i < attachmentsCount; i++)

{

embedDoc = doc.InlineShapes;

tempDoc = (Document)embedDoc.OLEFormat.Object;

tempDoc.SaveAs(ref tempFileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);


}



I need help to extract other types of documents(generally all type of attachments).



Regards
Ayyanar
Aug 31 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.