Share via

How to update Treemap chart XValues programmatically without losing information?

Anonymous
2025-03-28T10:58:04+00:00

I am developping a C# VSTO add-in for PowerPoint.

In this add-in, I have a feature that updates a chart that is linked to an Excel chart.

This feature extends the PowerPoint built-in update of links.

What I am doing by code is to set the PowerPoint chart series to the formula retrieved from the Excel source chart series :

foreach (IMsoSeries series in chartToUpdate.SeriesCollection())
{
    var excelSeries = excelSeriesList[seriesIndex];
    seriesIndex++;
    series.XValues = excelSeries.CategoriesFormula;
    series.Values = excelSeries.ValuesFormula;
}

CategoriesFormula is something like "='DONNEES GRAPH RECAP'!$A$3:$B$20"

This code works great will all charts, except with the Treemap charts.

In Excel, I have this very simple treemap chart based on this data set:

When copying the chart from Excel to PowerPoint, the result is at first as expected.

Now, when I am executing the update code above, even if data in Excel didn't change, the chart in PowerPoint is totally changed. It lose the information about the first columns (top level categories):

When looking at the OpenXML file, I can see that some information have been removed:

Before the update:

After the update:

We can see that the information with "Category 1" and "Category 2" has been removed.

Do you know how to fix that?

Microsoft 365 and Office | PowerPoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2025-04-04T01:00:37+00:00

    Dear Gradlon,

    You are welcome.

    I hope that you will get the issue fixed soon.

    Have a great day!

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2025-03-31T06:32:20+00:00

    Thanks, I did as suggested and posted the question on the dedicated dev forum: https://learn.microsoft.com/en-us/answers/questions/2242269/how-to-update-treemap-chart-xvalues-programmatical

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2025-03-29T02:24:47+00:00

    Dear Gradlon,

    For the Office development issues and questions, sorry for that we have limited resources. I'll keep the thread open for some time if there are some members here sharing some suggestions and opinions.

    We have a specific support channel coping with the Office development issues and questions. If there is no suggestion here after some time, I suggest you copy and paste the thread on Office Development - Microsoft Q&A for further help.

    The members there may investigate the code and help you fix the issue as soon as possible. It may take some time for them to investigate the issue and you can also share the code for their investigation.

    Your understanding is highly appreciated.

    Have a nice day!

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments