update data on a chart and then refresh underlying 'edit data' view

78 views Asked by At

Using the NetOffice PowerPoint API to update charts in PowerPoint using (eg)

using (NetOffice.PowerPointApi.Series ser = 
            (NetOffice.PowerPointApi.Series)xob2.Chart.SeriesCollection(xs))
{
    ser.Values = someNewValues;
}

while this accomplishes what I need for display (values are right, and the tooltip shows them as expected), if I select the graph and 'Edit Data' it opens a sheet with the original, unmodified data.

Is there a way to update the underlying sheet data, ideally without using code like

using (NetOffice.PowerPointApi.Chart cc = ob2.Chart)
{
    using (ChartData cd = cc.ChartData)
    {
        cd.Activate();
        using (Workbook wb = (Workbook)cd.Workbook)
        {
            using (Worksheet ws = (Worksheet)wb.Worksheets[1])
            ...
        }
    }
}

as I want to avoid the issues instantiating Excel seems to cause (RPC timeouts, clashes if two scripts are running concurrently, and the time factor - using direct manipulation seems to be about 2x faster than updating the worksheet)

I was hoping there would be a simple solution, but stumped so far (even looked at unzipping the pptx and editing the chart XMLs but that got messy fast!)

0

There are 0 answers