Does ASPOSE have solution for embedding Excel Sheet in to word (not as attachment but a viewable cell block in word)?
Thanks for your posting and using Aspose APIs.
You are inserting excel into word as OLE object which is a right approach. However, this question is not related to Aspose.Cells because you are not embedding word into excel but you are doing reverse so this question is related to Aspose.Words. Therefore, I am moving your thread to Aspose.Words forum.
Also, you have provided the expected output word file, please also provide actual output word file. Aspose.Words team will look into your issue and help you asap.
DocumentBuilder builder = new DocumentBuilder(doc);
Stream memoryStream = File.OpenRead(MyDir + "Worksheet in Test.xls");
Shape oleObject = builder.InsertOleObject(memoryStream, "Excel.Sheet.8", false, Image.FromFile(MyDir + "SheetImage.jpg"));
doc.Save(MyDir + @"out.docx");
Thanks for your prompt reply Hafeez. My company wants the excel to embedded into word not image, since they want to keep the option of updating the data. So is there anyway through aspose I could get the above attached file as output.
// 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)
//Extract OLE Excel object
if (shape.OleFormat.ProgId == "Excel.Sheet.12")
// Here you can use Aspose.Cells component
// to be able to convert MS Excel files to PDF
That solves it. Thanks!