I’m trying to update some linked charts in a PowerPoint presentation using slides for .Net. I have found several examples, but all mention methods like getLinkFormat and UpdateLinks, but trying to use those gives me an error that there is not a definition for those methods. I don’t see an example on in your Slides documentation on updating links, and trying to use the search within your API always tells me ‘No results’ .
Is there an example to show how to update links (either all at once or by looping through each slide) that will allow me to update embedded links? All of the links are from Excel files.
Summary
getLinkFormat and UpdateLinks belong to the Microsoft Office Interop API, not to Aspose.Slides for .NET. In Aspose.Slides you update a linked chart’s source workbook via the chart’s ChartData object using the SetExternalWorkbook method.
Why it happens
The compiler cannot find getLinkFormat or UpdateLinks because those members are not part of the Aspose.Slides object model. Linked‑chart handling is performed through IChart.ChartData, which provides SetExternalWorkbook to change the external Excel workbook reference.
What to do next
- Check the library version (the method is available in recent releases, e.g., 25.7 and later).
var version = typeof(Aspose.Slides.Presentation).Assembly.GetName().Version;
Console.WriteLine($"Aspose.Slides version: {version}");
If the method is missing, upgrade the NuGet package to a newer version.
- Replace the workbook link for each chart
using Aspose.Slides;
using Aspose.Slides.Charts;
// Load the presentation
var pres = new Presentation("Input.pptx");
// Path to the new Excel workbook (use the same path for all charts in this example)
string newWorkbookPath = @"C:\Data\UpdatedData.xlsx";
foreach (var slide in pres.Slides)
{
foreach (var shape in slide.Shapes)
{
if (shape is IChart chart)
{
// Replace the external workbook reference.
// Pass false to keep the existing chart data unchanged.
chart.ChartData.SetExternalWorkbook(newWorkbookPath, false);
}
}
}
// Save the modified presentation
pres.Save("Output.pptx", SaveFormat.Pptx);
-
Validate the change
Open Output.pptx in PowerPoint. The charts should now point to the new Excel file. If a chart shows#REF!or does not display the expected values, you can set the second argument totrue(or call the appropriate refresh method) to update the chart data after changing the link. -
Handle per‑chart workbook mappings
If different charts need different workbooks, replacenewWorkbookPathwith the appropriate path inside the loop (e.g., read a mapping from a configuration file) before callingSetExternalWorkbook.
These steps provide a complete workflow for updating linked Excel charts in a PPTX using Aspose.Slides for .NET.
I’m using Aspose.Slides.Net v25.11.0, and get an error that IChart can not be found.
To be clear regarding my original question, I want to refresh all of the external charts in the presentation, not change the location of the link.
@rickmeister,
Thank you for posting the question. Could you please share the simplest PowerPoint and Excel sample files and describe the expected result?
I’m working on getting sample files, but not sure my question is clear. I’m not trying to change the link for any of the objects in the presentation. There are links to charts and graphs to Excel files included in the PPTX file. I don’t want to change where those links point to - I simply want to refresh those links within Aspose. Basically it is the equivalent of clicking ‘Update Links’ when opening the Powerpoint file, then saving the updated file.
I can use Aspose.Cells to update the charts and graphs in the Excel files, but I then want to open the PowerPoint file from Aspose.Slides, refresh all of the objects, then save the updated PPTX file. I don’t want to have to click the Update Links button when I open the file manually - the updated charts and graphs should already be there.
@rickmeister,
Thank you for the explanation. I need some time to investigate the issue. I will get back to you as soon as possible.
@rickmeister,
We have opened the following new ticket(s) in our internal issue tracking system and will implement the feature according to the terms mentioned in Free Support Policies.
Issue ID(s): SLIDESNET-45217
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.