Insert excel charts to word as OLE object in .NET

Hi
How to insert chart in workbook as OLE object into Word document. we have to edit the chart from word document.

I have seen some tutorials not able to acheive perfectly.

Thanks

@karthik_karthik,

Thanks for your query.

Your query seems to me more related to Aspose.Words API as you are inserting chart into Word document. Aspose.Cells is a spreadsheet management library and handles MS Excel file formats. Anyways, I try to help you a bit. Well, there is no direct way to export only MS Excel charts to Word document. You can create an Excel chart either using Aspose.Cells or MS Excel, and then export it to an image using Aspose.Cells. Now using Aspose.Words API, you can insert an image in the Word document.

There can be another way to export the whole Excel workbook as OLE object in the Word document. Please check the following code example.

[.NET, C#]

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

Stream memoryStream = File.OpenRead(MyDir + “Book1.xls”);

Shape oleObject = builder.InsertOleObject(memoryStream, “Excel.Sheet.8”, true, null);

doc.Save(MyDir + @“out.docx”); 

It is better to post your query into Aspose.Words forums to get complete reference and details on your requirements.