Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Tue Oct 12, 2021 4:57 pm

Apologies if this information already exists but I want to replace the data behind a specific chart. Is there a built in method to do this? Is there an example?

Also, do all the charts use the same method or each chart has its own unique approach.

Links to documentation where I can learn more would be great also.

majeed_s
 
Posts: 80
Joined: Thu Mar 25, 2021 4:13 pm

Wed Oct 13, 2021 8:52 am

Hello,

Thank you for your inquiry.
Do you want to modify the data source of chart? If yes, please refer to the following code. If this does not meet your needs, please provide further information, sharing your input PowerPoint files and expected result files will be helpful. You could attach them here or send them to us via email (support@e-iceblue.com). Thanks in advance.
Code: Select all
Presentation ppt = new Presentation();
ppt.LoadFromFile("input.pptx");
IChart chart = ppt.Slides[0].Shapes[0] as IChart;
chart.ChartData[1, 1].Value = newData;
...
ppt.SaveToFile("output.pptx", FileFormat.Pptx2010);

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Tue Oct 26, 2021 12:38 pm

Great. Thank you for confirming.

majeed_s
 
Posts: 80
Joined: Thu Mar 25, 2021 4:13 pm

Wed Oct 27, 2021 1:11 am

Hello,

You're welcome.
If you have other questions about using Spire.Presentation in the future, please feel free to contact us.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.Presentation