Thank you for the interesting post.

I have tried to integrate your code into a C# project of mine but unfortunately I keep getting COM Errors.


foreach (InlineShape inlineShape in _wordApp.ActiveDocument.InlineShapes)
if (inlineShape.Type == WdInlineShapeType.wdInlineShapeEmbeddedOLEObject)

Chart chart = (Chart)inlineShape.OLEFormat.Object;
DataSheet datasheet = (chart as Chart).Application.DataSheet;
datasheet.Cells[0, 0] = "1";


Where _wordApp is a reference to an open Word Application which has an empty Document in it with a couple of charts.

This code fails on the following line:


with the following COM-Exception: HRESULT: 0x800A1704.

After removing the line, it fails on the next line:

Chart chart = (Chart)inlineShape.OLEFormat.Object;

with the following COM-Exception: HRESULT: 0x800401FD (CO_E_OBJNOTCONNECTED))

Does anyone have an idea on how to fix this?

This might not be the proper place to ask this kind of question, but the documentation concerning the Microsoft.Office.Interop.Graph.dll is limited to say the least.

Basically what I am trying to achieve is manipulating the data of an already existing chart in a Word-Document at runtime. There is another type of chart (Insert -> Picture -> Chart), which is even less documented and doesn't seem to even support OLEFormat.Object.

Thanks for the help,