NetOfficeFw / NetOffice

🌌 Create add-ins and automation code for Microsoft Office applications.
MIT License
697 stars 143 forks source link

[Powerpoint] Access Chart.SeriesCollection(n).Values and Chart.SeriesCollection(n).XValues #325

Closed Offbeatmammal closed 3 years ago

Offbeatmammal commented 3 years ago

In a VBA Powerpoint Macro I can access a chart's XValues and Values via a SeriesCollection, but via the NetOffice Powerpoint API this doesn't seem to be exposed?

I know I can work around this by selecting/updating the underlying cells, but this is the first difference between our 'legacy' VBA codebase and the NetOffice APIs that I'd encountered so wondered if I was missing something obvious (especially as the codebase does seem to have definitions for the Values/XValues).

jozefizso commented 3 years ago

Hi @Offbeatmammal, the Series.Values and Series.XValues properties are available in the PowerPoint API.

The issue with NetOffice PowerPoint API is that Chart.SeriesCollection(object index) returns the object type and not Series.

Please, try to cast the return value to a Series type so you can access those properties.

https://github.com/NetOfficeFw/NetOffice/blob/main/Source/PowerPoint/DispatchInterfaces/Series.cs#L566-L594 https://github.com/NetOfficeFw/NetOffice/blob/main/Source/PowerPoint/DispatchInterfaces/Chart.cs#L2216-L2219

Offbeatmammal commented 3 years ago

worked perfectly, thanks! still lots of learning curve jumping from VBA to C#!