From: Mogur on 20 Dec 2009 06:21 Hello all, I am having problems accessing a Chart object from C#. I guess this is related to my project's configuration... I am developing a PowerPoint Add-In using Visual Studio 2008 and C#. The Add-in inspects the slides of the current presentation when asking to do so, and access to different properties of their shapes. And I wanted to access to the properties of the graph the user has created. I have managed to get a Shape reference that, being a Placeholder, has a chart (the HasChart property is msoTrue, and the contained object of the placeholder is a msoChart). However, I cannot access to the Shape's Chart property. The simple access to the Chart property of my shape generates a compiler error. It is quite a bit frustrating because I know that the chart is there: I could access to its properties from VB (in other different project) and I can even see it while debugging the project in C#!!! The inspection of the object properties at debug time shows me the Chart property and all its fields. I guess this is something related to my project configuration, but I have no clue about what I am doing wrong. I am using using PowerPoint = Microsoft.Office.Interop.PowerPoint using Excel = Microsoft.Office.Interop.Excel and my project references among others: Microsoft.Office.Interop.Excel 12.0 Microsoft.Office.Interop.PowerPoint 12.0 Microsoft.Office.Tools.Common.v9.0 Microsoft.Office.Tools.v9.0 Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0 office 12.0.0.0 Thank you in advance!
From: Steve Rindsberg on 20 Dec 2009 12:45 If you're using PPT 2007, you need to update to at least SP1. Otherwise properties and methods show up in the object browser but do nothing (but generate errors). > I am having problems accessing a Chart object from C#. I guess this is > related to my project's configuration... > > I am developing a PowerPoint Add-In using Visual Studio 2008 and C#. The > Add-in inspects the slides of the current presentation when asking to do so, > and access to different properties of their shapes. > > And I wanted to access to the properties of the graph the user has > created. I have managed to get a Shape reference that, being a Placeholder, > has a chart (the HasChart property is msoTrue, and the contained object of > the placeholder is a msoChart). > > However, I cannot access to the Shape's Chart property. The simple access > to the Chart property of my shape generates a compiler error. > > It is quite a bit frustrating because I know that the chart is there: I > could access to its properties from VB (in other different project) and I can > even see it while debugging the project in C#!!! The inspection of the object > properties at debug time shows me the Chart property and all its fields. > > I guess this is something related to my project configuration, but I have > no clue about what I am doing wrong. > > I am using > > using PowerPoint = Microsoft.Office.Interop.PowerPoint > using Excel = Microsoft.Office.Interop.Excel > > and my project references among others: > > Microsoft.Office.Interop.Excel 12.0 > Microsoft.Office.Interop.PowerPoint 12.0 > Microsoft.Office.Tools.Common.v9.0 > Microsoft.Office.Tools.v9.0 > Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0 > office 12.0.0.0 > > Thank you in advance! ============================== PPT Frequently Asked Questions http://www.pptfaq.com/ PPTools add-ins for PowerPoint http://www.pptools.com/
From: Mogur on 20 Dec 2009 15:38 Thanks for your response. I have PPT 2007 SP2, and Visual Studio 2008 SP1, so it seems that this is not the problem... If I inspect the Microsoft.Office.Interop.PowerPoint assembly (version 12.0.0.0), the Shape interface does not have any Chart property. But I have not found any newest version of the interop assemblies. Best regards, "Steve Rindsberg" wrote: > If you're using PPT 2007, you need to update to at least SP1. > > Otherwise properties and methods show up in the object browser but do nothing > (but generate errors). > > > > > I am having problems accessing a Chart object from C#. I guess this is > > related to my project's configuration... > > > > I am developing a PowerPoint Add-In using Visual Studio 2008 and C#. The > > Add-in inspects the slides of the current presentation when asking to do so, > > and access to different properties of their shapes. > > > > And I wanted to access to the properties of the graph the user has > > created. I have managed to get a Shape reference that, being a Placeholder, > > has a chart (the HasChart property is msoTrue, and the contained object of > > the placeholder is a msoChart). > > > > However, I cannot access to the Shape's Chart property. The simple access > > to the Chart property of my shape generates a compiler error. > > > > It is quite a bit frustrating because I know that the chart is there: I > > could access to its properties from VB (in other different project) and I can > > even see it while debugging the project in C#!!! The inspection of the object > > properties at debug time shows me the Chart property and all its fields. > > > > I guess this is something related to my project configuration, but I have > > no clue about what I am doing wrong. > > > > I am using > > > > using PowerPoint = Microsoft.Office.Interop.PowerPoint > > using Excel = Microsoft.Office.Interop.Excel > > > > and my project references among others: > > > > Microsoft.Office.Interop.Excel 12.0 > > Microsoft.Office.Interop.PowerPoint 12.0 > > Microsoft.Office.Tools.Common.v9.0 > > Microsoft.Office.Tools.v9.0 > > Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0 > > office 12.0.0.0 > > > > Thank you in advance! > > > ============================== > PPT Frequently Asked Questions > http://www.pptfaq.com/ > > PPTools add-ins for PowerPoint > http://www.pptools.com/ > > > . >
From: Steve Rindsberg on 21 Dec 2009 11:28 In article <86278A00-05DB-4C10-84A3-94801454DB2A(a)microsoft.com>, Mogur wrote: > Thanks for your response. > > I have PPT 2007 SP2, and Visual Studio 2008 SP1, so it seems that this is > not the problem... No, although I was mistaken ... you *would* need SP2 rather than SP1. As a test, you might want to try adding a chart and manipulating in in VBA from within PPT, if only to determine whether it's possible. It should be, and if not, there's probably something amiss with your Office installation. Ex: assuming you've inserted a chart already and it's selected: Sub ChartTest() With ActiveWindow.Selection.ShapeRange(1) With .Chart With .ChartArea .Format.Fill.Forecolor.RGB = _ RGB(255,0,0) ' ugly but unmistakeable! ;-) End With End With End With End Sub > If I inspect the Microsoft.Office.Interop.PowerPoint assembly (version > 12.0.0.0), the Shape interface does not have any Chart property. But I have > not found any newest version of the interop assemblies. > > Best regards, > > "Steve Rindsberg" wrote: > > > If you're using PPT 2007, you need to update to at least SP1. > > > > Otherwise properties and methods show up in the object browser but do nothing > > (but generate errors). > > > > > > > > > I am having problems accessing a Chart object from C#. I guess this is > > > related to my project's configuration... > > > > > > I am developing a PowerPoint Add-In using Visual Studio 2008 and C#. The > > > Add-in inspects the slides of the current presentation when asking to do so, > > > and access to different properties of their shapes. > > > > > > And I wanted to access to the properties of the graph the user has > > > created. I have managed to get a Shape reference that, being a Placeholder, > > > has a chart (the HasChart property is msoTrue, and the contained object of > > > the placeholder is a msoChart). > > > > > > However, I cannot access to the Shape's Chart property. The simple access > > > to the Chart property of my shape generates a compiler error. > > > > > > It is quite a bit frustrating because I know that the chart is there: I > > > could access to its properties from VB (in other different project) and I can > > > even see it while debugging the project in C#!!! The inspection of the object > > > properties at debug time shows me the Chart property and all its fields. > > > > > > I guess this is something related to my project configuration, but I have > > > no clue about what I am doing wrong. > > > > > > I am using > > > > > > using PowerPoint = Microsoft.Office.Interop.PowerPoint > > > using Excel = Microsoft.Office.Interop.Excel > > > > > > and my project references among others: > > > > > > Microsoft.Office.Interop.Excel 12.0 > > > Microsoft.Office.Interop.PowerPoint 12.0 > > > Microsoft.Office.Tools.Common.v9.0 > > > Microsoft.Office.Tools.v9.0 > > > Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0 > > > office 12.0.0.0 > > > > > > Thank you in advance! > > > > > > ============================== > > PPT Frequently Asked Questions > > http://www.pptfaq.com/ > > > > PPTools add-ins for PowerPoint > > http://www.pptools.com/ > > > > > > . > > ============================== PPT Frequently Asked Questions http://www.pptfaq.com/ PPTools add-ins for PowerPoint http://www.pptools.com/
From: Boris on 23 Dec 2009 11:55 I ran into this same problem when i was trying to extract a chart that was selected on a slide, couldn't access the chart properties but i knew there was a chart there. Anyway to access the chart you have to create a PowerPoint.Chart object which will store your selected chart. eg. Microsoft.Office.Interop.PowerPoint.Chart selectedChart = null; selectedChart = mySelection.ShapeRange[1].Chart "Mogur" wrote: > Hello all, > > I am having problems accessing a Chart object from C#. I guess this is > related to my project's configuration... > > I am developing a PowerPoint Add-In using Visual Studio 2008 and C#. The > Add-in inspects the slides of the current presentation when asking to do so, > and access to different properties of their shapes. > > And I wanted to access to the properties of the graph the user has > created. I have managed to get a Shape reference that, being a Placeholder, > has a chart (the HasChart property is msoTrue, and the contained object of > the placeholder is a msoChart). > > However, I cannot access to the Shape's Chart property. The simple access > to the Chart property of my shape generates a compiler error. > > It is quite a bit frustrating because I know that the chart is there: I > could access to its properties from VB (in other different project) and I can > even see it while debugging the project in C#!!! The inspection of the object > properties at debug time shows me the Chart property and all its fields. > > I guess this is something related to my project configuration, but I have > no clue about what I am doing wrong. > > I am using > > using PowerPoint = Microsoft.Office.Interop.PowerPoint > using Excel = Microsoft.Office.Interop.Excel > > and my project references among others: > > Microsoft.Office.Interop.Excel 12.0 > Microsoft.Office.Interop.PowerPoint 12.0 > Microsoft.Office.Tools.Common.v9.0 > Microsoft.Office.Tools.v9.0 > Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0 > office 12.0.0.0 > > Thank you in advance! >
|
Pages: 1 Prev: Removing a template added using VBA Next: How do I create a mirror image of a graphic? |