User-92425567 posted
Hi EveryBody,
I am using "Microsoft.Office.Interop.Word" in my program to insert and retrieve images from/into a Word File.
I can easily insert now an image into header section into a doc file using it. But when I tried to retrieve them from headers to save them as JPEG, I can't do so.
Please Help me any one, I m in need indeed. The code I used is given. I am getting the exact counting of images from the word file.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
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);
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$