We help IT Professionals succeed at work.

Infragistics and MS Word 2007

Tom Knowlton
Tom Knowlton asked
on
For those of you who are familiar with the Infragistics Windows Form controls -- is there any way to integrate their output with a MS Word 2007 document?  Such that I could have a pie chart or a bar graph in a Word document?
Comment
Watch Question

Top Expert 2006

Commented:
Hi Knowlton,

Could you take a screen shot of the control with the data rendered, and then embed that in to Word as a bitmap?
Tom KnowltonWeb developer

Author

Commented:
I've thought about doing that.  It may end-up coming to that.

How easy is it to do this in C#?
Top Expert 2006
Commented:
You can take a screen shot of the control by using,

  Bitmap bitmap = new Bitmap(control.Width, control.Height);
  using (Graphics g = Graphics.FromImage(bitmap))
    g.CopyFromScreen(PointToScreen(control.Location), Point.Empty, control.Size);

After saving the bitmap, I believe you can use Document.InlineShapes.AddPicture to get that file in to your Word document (I know you have more experience with Word automation than I do).
Tom KnowltonWeb developer

Author

Commented:
Thank you for your help.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.