B
Bernhard
Hi
I have thousands of work documents with embedded object which I need to
extract.
I am able to extract embedded word or excel but I am having troubles with
embedded Objects of the type "Package".
I am able to determine that an embedded object is a package but I am not
able to determine what that package contains. A package could contain again
another word document or a picture but I could not find any way to
programmatically determine what it contains. Neither was I able to extract
the document or picture it contains.
Does anyone know how to determine the content of a "Package"?
Does anyone know how to extract the content programmatically?
Thanks in advance for your help.
Below is my C# Source which loops over all embedded objects.
My source
object missing = System.Reflection.Missing.Value;
object readonlyobj = false;
_wordApp = new MsWord.ApplicationClass();
_wordApp.Visible = true;
MsWord.Document _wordDocument = _wordApp.Documents.Open(
ref filename, ref missing, ref readonlyobj, 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);
foreach (MsWord.InlineShape inlineShape in _wordDocument.InlineShapes)
{
if (inlineShape.Type ==
MsWord.WdInlineShapeType.wdInlineShapeEmbeddedOLEObject)
{
if (inlineShape.OLEFormat != null)
{
MsWord.OLEFormat oleFormat = inlineShape.OLEFormat;
string progID = oleFormat.ProgID;
if (progID != null)
{
if (progID == "Package")
{
// Is an embedded object of the pyte "Package" ->
Microsoft Object-Manager
// -> How to find what is contained in the package?
// -> How to extract it?
}
//oleFormat.Open();
//Field field = inlineShape.Field;
//field.Copy();
}
}
}
I have thousands of work documents with embedded object which I need to
extract.
I am able to extract embedded word or excel but I am having troubles with
embedded Objects of the type "Package".
I am able to determine that an embedded object is a package but I am not
able to determine what that package contains. A package could contain again
another word document or a picture but I could not find any way to
programmatically determine what it contains. Neither was I able to extract
the document or picture it contains.
Does anyone know how to determine the content of a "Package"?
Does anyone know how to extract the content programmatically?
Thanks in advance for your help.
Below is my C# Source which loops over all embedded objects.
My source
object missing = System.Reflection.Missing.Value;
object readonlyobj = false;
_wordApp = new MsWord.ApplicationClass();
_wordApp.Visible = true;
MsWord.Document _wordDocument = _wordApp.Documents.Open(
ref filename, ref missing, ref readonlyobj, 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);
foreach (MsWord.InlineShape inlineShape in _wordDocument.InlineShapes)
{
if (inlineShape.Type ==
MsWord.WdInlineShapeType.wdInlineShapeEmbeddedOLEObject)
{
if (inlineShape.OLEFormat != null)
{
MsWord.OLEFormat oleFormat = inlineShape.OLEFormat;
string progID = oleFormat.ProgID;
if (progID != null)
{
if (progID == "Package")
{
// Is an embedded object of the pyte "Package" ->
Microsoft Object-Manager
// -> How to find what is contained in the package?
// -> How to extract it?
}
//oleFormat.Open();
//Field field = inlineShape.Field;
//field.Copy();
}
}
}