none
C# : PowerPoint : MS Graph-Chart : Write a similar control with its own table ?

    Question

  • Hallo there,

    I would like to write a C# routine for adding my own drawn shapes and charts in MS PowerPoint connected to their own (excel look-like) tables. Similarly  However, I have no idea, how to connect a (excel-look like) table to my own shape/chart, so that when I type a new value in this table, I will be able to reshape the corresponding shape. (A similar example to what I want to do is the MS Graph Char object)

    I would appreciate any help.

    Best,


    • Edited by HeinrichMS Thursday, December 06, 2012 7:27 AM inserting MS PowerPoint in the text, to remove misunderstandings...
    • Moved by Cindy Meister MVPMVP, Moderator Thursday, December 06, 2012 8:15 PM not using VSTO technology (From:Visual Studio Tools for Office)
    Wednesday, December 05, 2012 1:37 PM

Answers

  • Hi Heinrich

    Yes, MS Graph does have an automation API. But the way you asked the question indicated you wanted to create something of your own.

    MS Graph works with the old Excel charting engine, but the data table is its own and, as far as I know, is not related to Excel. In any case, Excel need not be installed for MS Graph to function. OTOH it also doesn't support all the automation functionality that Excel used to offer, nor is it possible to automate everything that can be done by the user.

    You cannot use the MS Graph table independently of MS Graph.

    Here's the skeleton of the MS Graph API, used in Word (as I happen to have this laying around).

    Dim grph as Graph.Object
    Dim sht as Graph.DataSheet
    Dim olef as Word.OleFormat
    
    Set olef = Doc.InlineShapes.AddOLEObject(ClassType:="MSGraph.Chart.8").OleFormat
    Set grph = olef.Object
    Set sht = grph.Application.DataSheet

     


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, December 06, 2012 8:41 PM
    Moderator
  • Hi Heinrich

    As I recall, I researched the object model by using the VBA object browser. I set a reference to the MSGraph object model through Tools/References. Then F2 to open the Object Browser. From the list of libraries to search in I chose MS Graph. Then I just started to read through the top-level objects, their properties, etc. And I experimented a lot.

    At the time (this would have been about 10 years ago) There was also some Help documentation, although not very good. And I have an old set of Office 2000 Language Reference books - back in those days you could still get print editions of the Help that has a section on MS Graph.

    There's also: http://support.microsoft.com/kb/190239 and http://msdn.microsoft.com/en-us/library/aa297308(office.11).aspx


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, December 07, 2012 12:36 PM
    Moderator

All replies

  • Hello Heinrich

    If I understand your question correctly you have no interest in working with Office applications? Your only concern is a tool or control that looks similar to MS Graph?

    In that case, the Office development forums are certainly the wrong place to post this question...


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, December 05, 2012 5:06 PM
    Moderator
  • As the title says: I DO want to work with Office- PowerPoint.

    Thanks anyway for the answer.

    Thursday, December 06, 2012 7:26 AM
  • Hi Heinrich

    << I have no idea, how to connect a (excel-look like) table to my own shape/chart>>

    Let me phrase it another way: if you want to build your own control - which would have to be wrapped in ActiveX (Ax) technology - you're in the wrong place. Building such a control isn't something that's supported by the Office technologies; there's no way you can leverage existing libraries, such as MS Graph, as all Office classes are sealed.

    Once you're at the point of wanting to use your control, the most appropriate forum would be General Office Development. That said, before such a group existed there were similar questions handled in this, the VSTO forum, where ex-COM specialists who are no longer with the VSTO team provided some advice on what kind of settings the ActiveX control needed to have in order to be acceptable, in a general way, to an Office application.


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, December 06, 2012 7:45 AM
    Moderator
  • Hallo Cindy,

    so, you are saying that the MS Graph-Chart Object does not have a (COM) Interface, to be used like a normal (COM) chart object ?

    How about the table it uses. It looks like an excel object, is it really such one? How can I access this table object  ?

    Best,

    Thursday, December 06, 2012 9:28 AM
  • Hi,

    I think you could try the solution in this page Dynamic graph from excel into powerpoint.

    HTH.


    Regards,
    Fermin
    What's life without whimsy?

    Thursday, December 06, 2012 11:45 AM
  • Thank you Fermin for the answer (Cindy thank you as well, I forgot)

    However, that is the point, that I dont want to use Excel directly, but in the way how the MS Graph-Chart object handles this. It opens a table, which looks like an excel worksheet, but its not excel. I want to have the same, just a small table on the side of my chart. Do you have any ideas how this can be done ?

    Best regards,

    Thursday, December 06, 2012 11:52 AM
  • Hi Heinrich

    Yes, MS Graph does have an automation API. But the way you asked the question indicated you wanted to create something of your own.

    MS Graph works with the old Excel charting engine, but the data table is its own and, as far as I know, is not related to Excel. In any case, Excel need not be installed for MS Graph to function. OTOH it also doesn't support all the automation functionality that Excel used to offer, nor is it possible to automate everything that can be done by the user.

    You cannot use the MS Graph table independently of MS Graph.

    Here's the skeleton of the MS Graph API, used in Word (as I happen to have this laying around).

    Dim grph as Graph.Object
    Dim sht as Graph.DataSheet
    Dim olef as Word.OleFormat
    
    Set olef = Doc.InlineShapes.AddOLEObject(ClassType:="MSGraph.Chart.8").OleFormat
    Set grph = olef.Object
    Set sht = grph.Application.DataSheet

     


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, December 06, 2012 8:41 PM
    Moderator
  • Hallo Cindy,

    thanks for the answer.

    You are right, I want to create sth on my own, but first I want to see how the MS Graph makes it. I will try the example (which I have to translate first in C#) and report back.

    Btw how did you know, it has a DataSheet ? Where do I find documentation about it ?

    Best,

    Friday, December 07, 2012 7:26 AM
  • Hi Heinrich

    As I recall, I researched the object model by using the VBA object browser. I set a reference to the MSGraph object model through Tools/References. Then F2 to open the Object Browser. From the list of libraries to search in I chose MS Graph. Then I just started to read through the top-level objects, their properties, etc. And I experimented a lot.

    At the time (this would have been about 10 years ago) There was also some Help documentation, although not very good. And I have an old set of Office 2000 Language Reference books - back in those days you could still get print editions of the Help that has a section on MS Graph.

    There's also: http://support.microsoft.com/kb/190239 and http://msdn.microsoft.com/en-us/library/aa297308(office.11).aspx


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, December 07, 2012 12:36 PM
    Moderator