Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for your request. IN DOCX document, there can be two kinds of Embedded objects:
1. OLE objects. Aspose.Words supports such objects, so you can extract them from document.
2. “Embedded Packages”. This is new way of embedding objects into MS Word document, which was introduced in DOCX. Currently, Aspose.Words does not support extracting such objects.
Your request has been linked to the appropriate issue. You will be notified as soon as it is supported.
Inserting new OLE objects into Word documents and updating existing OLE objects is not supported at the moment. Inserting an OLE object usually requires the host application and probably cannot be done by Aspose.Words.
Here is simple code, which shows how to extract OLE objects from the document:
// Open document.
Document doc = new Document("C:\\Temp\\in.doc");
// Get all shapes.
NodeCollection shapes = doc.getChildNodes(NodeType.SHAPE, true);
// Loop through all shapes.
for (int i = 0; i < shapes.getCount(); i++)
{
Shape shape = (Shape)shapes.get(i);
// Check if the current shape has OLE object
if (shape.getOleFormat() == null)
continue;
// Determine extenfion of the object.
// Let's use bin extension by default.
String extension = "bin";
if (shape.getOleFormat().getProgId().equals("Word.Document.8"))
extension = "doc";
if (shape.getOleFormat().getProgId().equals("Excel.Sheet.8"))
extension = "xls";
// Save OLE object.
shape.getOleFormat().save(String.format("C:\\Temp\\out_%d.%s", i, extension));
}
Best regards,