• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1787
  • Last Modified:

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.
0
Tom Knowlton
Asked:
Tom Knowlton
  • 3
  • 2
1 Solution
 
Smart_ManCommented:
2007 ? 2003 ?

do you knwo hwo to write code in ms word ?
0
 
Tom KnowltonWeb developerAuthor Commented:
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);
0
 
Tom KnowltonWeb developerAuthor Commented:
Looks like I can tweak this line:

 object oClassType = "MSGraph.Chart.8";
0
 
Smart_ManCommented:
try and we are waiting for your feedback
0
 
Tom KnowltonWeb developerAuthor Commented:
It works.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now