We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to know if we have embedded files inside word document

Hi,

I am want to know if word file has another files inserted within. For example a function that returns true if exe file is inserted within word document and false if there is just text within file.

Thanks,

@patelreenaj,

Please ZIP and attach your sample Word document containing embedded files here for testing. We will then investigate the scenario on our end and provide you more information.

attached zip fileObject Test.zip (1.3 MB)

@patelreenaj,

Please try using the following code:

Document doc = new Document("E:\\Object Test\\Object Test.docx");

int i = 0;
foreach (Shape shape in doc.GetChildNodes(NodeType.Shape, true))
{
    if (shape.OleFormat != null)
    {
        i++;
    }
}

Console.WriteLine("This document has '{0}' embedded objects", i);