C# : PowerPoint : Dynamically read typed values in Excel

Answered C# : PowerPoint : Dynamically read typed values in Excel

  • Thursday, December 06, 2012 2:30 PM
     
     

    Hallo there,

    I would like to write an Add-In in C# for PowerPoint, which opens Excel, and reads from it when a cell has been changed.

    How is this done in code ?

    Any advice will be appreciate it.

All Replies

  • Sunday, December 09, 2012 9:28 AM
    Moderator
     
     Answered

    Hi HeinrichMS,

    Thank you for posting in the MSDN Forum.

    Based on this page, I've create a PowerPoint add-in for you. You'll see a button on the Add-Ins Tab. Click it an Excel application will start up. Tap something in any cell of Sheet1, then what you've tapped will be used as title of slide 1.

    I've upload the project to SkyDrive, you can download from http://sdrv.ms/SIcR5R.

    Hope it helps.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Sunday, December 09, 2012 3:36 PM
     
      Has Code

    Thank you very much.

    Do you know how after inserting a data chart into powerpoint to reselect in C# the data area of the chart, i.e. the selection area shown in the Excel sheet?

    Im trying this one, but it is throwing an exception

    range = worksheet.get_Range("A3", "B4");

    myChart.SetSourceData(range.ToString(), Excel.XlRowCol.xlColumns);

    Best,



    • Edited by HeinrichMS Sunday, December 09, 2012 5:49 PM code sniplet
    • Edited by HeinrichMS Sunday, December 09, 2012 5:50 PM
    •  
  • Monday, December 10, 2012 12:23 PM
    Moderator
     
      Has Code

    Hi HeinrichMS,

    Thank you for your last reply.

    You can try the code below

    range = worksheet.get_Range("A3", "B4");
    
    myChart.SetSourceData(range, Excel.XlRowCol.xlColumns);
    
    

    Hope it helps.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Monday, December 10, 2012 1:54 PM
     
     
    Thanks, but no, it didnt help. Best,
  • Wednesday, December 12, 2012 12:41 PM
    Moderator
     
     Answered

    Hi HeinrichMS,

    Thank you for your last reply.

    I think you'll need to add the worksheet's name into the Source parameter.

    You can refer to this blog for detailed information.

    Besides, I've figured out that range.ToString() will not work, you'll need to use range.Address to get the address of the range.

    Hope it helps.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.