Link to home
Start Free TrialLog in
Avatar of Tom Knowlton
Tom KnowltonFlag for United States of America

asked on

C# Automation in MS Word 2007

How do you programmatically insert a pie chart or a bar graph using C# MS Word automation?
I need sample code.
Avatar of Smart_Man
Smart_Man
Flag of Egypt image

2007 ? 2003 ?

do you knwo hwo to write code in ms word ?
Avatar of Tom Knowlton

ASKER

MS Word 2007.

It looks like this works:

  //Insert a chart.
            Microsoft.Office.Interop.Word.InlineShape oShape;
            object oClassType = "MSGraph.Chart.8";
            wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
            oShape = wrdRng.InlineShapes.AddOLEObject(ref oClassType, ref oMissing,
                ref oMissing, ref oMissing, ref oMissing,
                ref oMissing, ref oMissing, ref oMissing);
Looks like I can tweak this line:

 object oClassType = "MSGraph.Chart.8";
ASKER CERTIFIED SOLUTION
Avatar of Smart_Man
Smart_Man
Flag of Egypt image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It works.