Munendra Kumar 0 Newbie Poster

In word automation, how ca i retrive and save images from a word file's header section. I can get the counting of header section's images but want to save them or extract them into jpg format onto my harddisk. I m using "Microsoft.Office.Interop.Word" dll.

Code is : ------

object oMissing = System.Reflection.Missing.Value;
        //OBJECT OF MISSING "NULL VALUE"
        //Object oMissing = System.Reflection.Missing.Value();
        //OBJECTS OF FALSE AND TRUE
        object oTrue = true;
        object oFalse = false;
        object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
        Word._Application oWord;
        Word._Document oDoc;
        oWord = new Word.Application();
        //oWord.Visible = true;
        oWord.Visible = false;

        Object oOpenFile = (Object)"C:\\CRM.doc";
        oDoc = oWord.Documents.Open(ref oOpenFile, ref oMissing, ref oMissing, ref oMissing,
            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
            ref oMissing, ref oMissing);

        foreach (Word.Section section in oDoc.Application.ActiveDocument.Sections)
        {
            foreach (Word.HeaderFooter header in section.Headers)
            {
                foreach (Word.Shape shape in header.Shapes)
                {
                    //Response.Write(header.Shapes.Count.ToString());
                }
            }
        }
        //CLOSING THE FILE
        oDoc.Close(ref oFalse, ref oMissing, ref oMissing);
        //QUITTING THE APPLICATION
        oWord.Quit(ref oMissing, ref oMissing, ref oMissing);