I'm having massive problems when trying to update a chart through MSWord interop. All I want to do is set the values on a chart in a word document so the graph can update to values in my app.
I've done the following (after importing Microsoft.Office.Interop.Graph.dll):
InlineShape chartShape = WordDocument.InlineShapes[2];
chartShape.Activate(); // for opening Chart in edit mode
// Convert the InlineShape into Chart type which is a part of Microsoft.Office.Interop.Graph
Microsoft.Office.Interop.Graph.Chart oChart = (Microsoft.Office.Interop.Graph.Chart) chartShape.OLEFormat.Object;
Microsoft.Office.Interop.Graph.DataSheet dataSheet = oChart.Application.DataSheet;
dataSheet.Cells[1, 1] = 10;
Firstly it throws a COMException (That metod is not available on that object) on the Activate() method. If I hope over that, the actual OLEFormat.Object throws an InvalidCastException (the specified cast is not valid).
Anyhow managed to get something like this to work?