469,946 Members | 1,344 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,946 developers. It's quick & easy.

Extract embedded documents in the word document

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
0 1071

Post your reply

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

Similar topics

1 post views Thread by mickeydisn | last post: by
4 posts views Thread by Lewis Edward Moten III | last post: by
3 posts views Thread by Adam Faulkner via DotNetMonster.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.