Extracting embedded objects

I am currently using Aspose.Words to extract objects from word files. I am having a problem where a few files are not being extracted properly. I investigated the two files which were giving problems and I realized that they both had the progid outlook.fileattach. I searched the forums looking for a problem relating to outlook.fileattach. I came across this link https://forum.aspose.com/t/113547 but I wasn’t able to access it. I would like to get access to the link. And i would like to know if there is any other solution to my problem

Hi,
Thanks for sharing that you could not access https://forum.aspose.com/t/113547. It is a private thread so you shouldn’t access it. Put simply, it is not a bug. Due to this, I’m quite curious about how you came to know that link. I will appreciate you if you can share that.
The product team will help you for the technical issues you’re concerned with shortly.

Hi
Thanks for your inquiry. Could you please attach your document for testing? (Only you and Aspose staff members can download it) I will investigate your problem and try to help you.
There were problems with outlook.fileattach, but this issue was fixed few releases ago. Make sure you are using latest version of Aspose.Words.
Best regards.

This is the document which is giving the problems. There is one thing to note. I am extracting these files programatically using shape.oleformat.save.

Hi
Thank you for additional information. I tried using the following code and all works fine on my side. (I use Aspose.Words v5.0.2)

Document doc = new Document(@"Test040\document+to+upload.doc");
NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
int i = 0;
foreach (Shape shape in shapes)
{
    if (shape.OleFormat != null)
    {
        shape.OleFormat.Save(@"Test040\obj_" + shape.OleFormat.ProgId + i.ToString() + ".doc");
        i++;
    }
}

Note, Aspose.Words extracts the original file from an Outlook.FileAttachment. So you should save document with its original extension.
I hope this could help you.
Best regards.

I also was able to extract the documents and i did give them a “.doc”
extension but the problem is that the extracted file are not being
opened by word. When i try to open the document i get the attached
window which indicates that it is not recognised by word. This doesn’t happen for the documents which have a progid of word.document.8 which led me to believe that it was a problem with documents with a progid of outlook.fileattach. Could you confirm that you are able to open the extracted document?

Yes, I can open extracted documents without any problems. Please make sure that you are using the latest version of Aspose.Words.
Best regards.

I installed the lastest version of aspose word and it works. I am able to extract the files properly now. Thanks.