none
How can I get Chart object in Word 2010 using C# RRS feed

  • Question

  • Hi,

    I have a question about how to get Chart object in Word 2010.

    if i insert a object on Ribbon [Insert ] -> Group [Text] -> Object, choose [Microsoft Graph Chart]

    How can i get this chart by C# code?

    Thursday, November 15, 2012 10:02 AM

Answers

All replies

  • Hi Sunny,

    Thank you for posting in the MSDN Forum.

    According to your description, I suggest you try Document.InlineShapes property. This property will return a collection of InlineShape objects.

    Hope it helps. If you still have any questions about it, please feel free to let know.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us

    Friday, November 16, 2012 12:58 PM
    Moderator
  • Hi Quist,

    Yes, I can get an InlineShape by below code:

    Word.InlineShape objShape = this.ThisApplication.ActiveDocument.InlineShapes[1];

    But how can I convert [objShape] to [Microsoft .Office .Interop.Graph.Chart] type?

    Looking forward to your reply:)

    Tuesday, November 20, 2012 8:49 AM
  • Hi Sunny

    if (objShape.HasChart)

    { Chart ch = objShape.Chart; }


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, November 20, 2012 9:06 AM
    Moderator