我尝试修改包含两个图表的 PowerPoint 幻灯片。我的目标是找到图表并修改其数据。
我已经获得了包含图表的 GraphicFrame,并且获得了要修改的 ChartSpace 元素的相对 ID。但是如何获得实际的 ChartSpace 元素呢?
public void test()
{
//// getting the SlidePart
var slidepart = presPart.GetPartById(relId) as SlidePart;
//// getting the Shape which contains the damned Chart
var graphicFrame = GetGraphicFrameFromSlide(slidepart, ppChart, ppSlide);
//// get the ChartReference
DrawCharts.ChartReference child = GraphicFrame.Graphic.GraphicData.GetFirstChild<DrawCharts.ChartReference>();
var chartID = child.Id;
//// this returns a ExtendedSomething, but no chart reference :(
var chartData = presDoc.GetPartById(chartID) ;
}