Get the names of the categories of the waterfall

I am trying to read the waterfall category names in the VSTO PowerPoint project.
So far I have not been able to do this.

Here is what I tried:

  • chart.SeriesCollection(x).Axes(y).CategoryNames - not available for this type of chart
  • chart.SeriesCollection(x).XValues - not available for this type of chart
  • chart.SeriesCollection(x).Points(y).DataLabel.Text/ .Caption- this returns the point value, not the category name, for example. -130
  • chart.SeriesCollection(x).DataLabels(y).Text/ .Caption- same as previous: it returns point values

Then I tried to read the source data directly through chart.ChartData.Workbook, but this is also not possible.

So how can I read category names?

+4
source share
1 answer

, XlChartType Waterfall. ( ChartType 119, .)

, , , PowerPoint Undo .

PowerPoint.Chart myChart = Globals.ThisAddIn.Application.ActivePresentation.Slides[1].Shapes[2].Chart;
myChart.ChartType = Office.XlChartType.xlBarStacked;
PowerPoint.Axis CategoryAxis = Globals.ThisAddIn.Application.ActivePresentation.Slides[1].Shapes[2].Chart.Axes(PowerPoint.XlAxisType.xlCategory, PowerPoint.XlAxisGroup.xlPrimary);
Array CatNames = (Array)((object)CategoryAxis.CategoryNames);
Globals.ThisAddIn.Application.CommandBars.ExecuteMso("Undo");
//Do something here with the CatNames array
+2

Source: https://habr.com/ru/post/1695166/


All Articles