Extracting embedded objects from Word- Power Point & Excel

Hi,
I am very much interested in extracting embedded objects from Word, Power Point & Excel, I show your product supports that, I found lots of forum postings, gor .net sample, but was not able to put togather everything in place and wandering if you can send me a sample code piece which will extract embedded objects from a word file.
Will will eveluate Power Point and Excel once we are satisfied with word.
Some where in your blogs someone also mentioned that they are able to identify embedded objects file types by using getOleentry method, I tried to do that one the sample file attached (abc.doc) but can not get desired results, can you please look into the attached file and provide me a code sample to extract all embedded objects from the wword doc file.
Thank you in advance.

Hi

Thanks for your inquiry. Some file formats you can identify using OleFormat.ProgId. Please see the following example:

// Open document
Document doc = new Document(@"Test001\in1.doc");
// Get collection of shapes
NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
int i = 0;
// Loop through all shapes
foreach(Shape shape in shapes)
{
    if (shape.OleFormat != null)
    {
        // Get extension of th eOL object.
        string ext = "object";
        switch (shape.OleFormat.ProgId)
        {
            case "Excel.Sheet.8":
                ext = "xls";
                break;
            case "AcroExch.Document.7":
                ext = "pdf";
                break;
        }
        shape.OleFormat.Save(String.Format(@"Test001\out_{0}.{1}", i, ext));
        i++;
    }
}

However, different file formats, like TXT, ZIP or RAR archives etc have the same ProgId, so you should implement your own logic to identify type of such objects.
Also, I found two issues upon extracting OLE objects from your document.

  1. Exception occurs, when I try to get the 7th object.
  2. Excel file extracted from your document is broken.

I will notify you once these problems are resolved.
Best regards.

The issues you have found earlier (filed as 10087) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as 9995) have been fixed in this update.