Received : 2007/07/09 16:47:04
Message : can you please provide (or direct me to) an example of extracting an embedded OLE document from a word document using Aspose.Words 4.2.6.0 (.NET, C# if possible)
This message was posted using Aspose.Live 2 Forum
Here is a sample code that extracts all embedded documents from the given document. Please note, that original embedded document names are not stored in document file, so you need to assign them yourself.
Document doc = new Document("Test.doc");
NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
int embeddedNumber = 0;
foreach (Shape shape in shapes)
{
if (shape.ShapeType == ShapeType.OleObject)
{
FileStream stream = new FileStream("embeddedDoc" + embeddedNumber), FileMode.Create);
shape.OleFormat.Save(stream);
stream.Close();
embeddedNumber++;
}
}
Hope this helps,