Request for Relative Path Support in SetExternalWorkbook (Aspose.Slides.NET)

Aspose.Slides does not support relative ExternalWorkbookPath for linked charts (PowerPoint supports this natively on Windows)


Issue Summary

PowerPoint on Windows supports linking a chart to an external Excel workbook using a relative path, where the link contains only the filename without extension (e.g., BudgetTemplate).

When setting the external workbook path using Aspose.Slides via:

chart.ChartData.SetExternalWorkbook("NewReportName", false);

Aspose instead serializes the link as an absolute file path, pointing to the working directory inside the container (e.g., file:///usr/lib/NewReportName.xlsx).

This prevents PowerPoint from resolving the correct workbook once the files are downloaded and opened by the user.

We need Aspose.Slides to support relative external workbook paths, exactly the way PowerPoint natively does.


Expected Behavior (Native PowerPoint, Windows)

In PowerPoint for Windows, you can link a chart to an Excel file by placing both files in the same folder.

PowerPoint stores just the workbook name:
ExternalWorkbookPath = "BudgetTemplate"
There is no file:// , no absolute path , and often no extension .

When the user opens the PPTX, PowerPoint resolves the Excel file relative to the slideshow’s location automatically. Results in Aspose generating something like:
file:///usr/lib/NewReportName.xlsx
(where /usr/lib/ is the working directory of our Docker container).

When the user downloads the final report as a ZIP (containing both the PPTX and the Excel file in the same folder), PowerPoint cannot resolve the link, and the user must manually relink every chart.

Why This Matters (Our Use Case, Astrato Analytics)

Our product Astrato Analytics (astrato.io) generates automated PowerPoint reports based on user-provided PPTX and XLSX templates.

Workflow:

  1. User uploads a PPTX template and an XLSX template.
  2. Inside our Dockerized backend, we load and update the Excel file.
  3. We update the PowerPoint charts using:
chart.ChartData.SetExternalWorkbook(tempExcelPath, true); 
  1. When we’re done, we prepare a ZIP file for the user containing:
  • NewReportName.pptx
  • NewReportName.xlsxBoth in the same folder inside the zip.At this point, we want to set the chart’s external link to the final Excel filename without path, e.g.:
chart.ChartData.SetExternalWorkbook("NewReportName", false);
  1. so that PowerPoint can resolve the Excel workbook relative to the PPTX location, as it does natively on Windows.
  2. The user unzips the file and opens NewReportName.pptx.PowerPoint should then automatically resolve the link to NewReportName.xlsx in the same folder.

However, Aspose.Slides currently rewrites this relative name into an absolute path based on the Docker working directory, for example:
file:///usr/lib/NewReportName.xlsx
When the user unzips and opens the file on Windows, this path is invalid in their environment. PowerPoint cannot find the workbook and the chart link must be manually repaired.

If Aspose would preserve the relative external workbook path, e.g.:
ExternalWorkbookPath = "NewReportName"
PowerPoint on Windows would correctly resolve the link as intended.


Feature Request

Please add support for:

  1. Relative external workbook paths , e.g.:
    ExternalWorkbookPath = "NewReportName"
  2. without file:// and without an absolute directory.
  3. When updateChartData = false, do not rewrite the given path into an absolute URI.Instead, preserve the path exactly as passed to SetExternalWorkbook, so we can intentionally set a relative reference that PowerPoint will resolve at runtime.

Impact

This behavior breaks our automated reporting scenario:

  • Users receive a PPTX + XLSX zip with matching names.
  • PowerPoint cannot resolve the Excel links because the paths are turned into absolute container paths instead of relative names.
  • Users are forced to manually repair links, defeating the purpose of automation.

Relative path support (or at least preserving the provided relative path) would solve this cleanly.

@karl.sjostrand

Re: Request for Relative Path Support in SetExternalWorkbook (Aspose.Slides .NET)

Summary

You would like Aspose.Slides to keep the workbook reference that you pass to

chart.ChartData.SetExternalWorkbook("NewReportName", false);

as a relative name (e.g., ExternalWorkbookPath="NewReportName"), without being rewritten to an absolute URI such as file:///usr/lib/NewReportName.xlsx.

At the moment the library always stores an absolute URI, which prevents PowerPoint from resolving the link when the PPTX and XLSX are delivered together in a zip file.


Current Behaviour

Method call What Aspose.Slides does
SetExternalWorkbook(string path, bool updateChartData) Normalises the supplied path to an absolute file URI and writes it to the chart’s ExternalWorkbookPath element in the PPTX package. This is performed regardless of the updateChartData flag.

The design follows the Open XML specification, which states that the externalWorkbookPath is a URI. Consequently, the SDK converts any relative string into an absolute URI based on the current working directory (your Docker container in this case).


Work‑arounds (Supported)

Approach Description Important notes
Post‑process the PPTX XML After saving the presentation, open the PPTX (a zip archive) and edit the _rels part that contains externalData linkage. Replace the absolute URI with the desired relative name. - Requires manual XML manipulation; not covered by the SDK API.
- Must be done after presentation.Save() and before the file is delivered to the user.
Create a custom part Use the low‑level API (presentation.Package) to add a custom relationship that points to a relative path. - Advanced scenario; you need to be familiar with the Open XML package structure.
- Still not a native SDK feature.

Example – simple XML fix

using System.IO;
using System.IO.Compression;
using System.Xml;

// 1. Save the presentation normally
presentation.Save("NewReportName.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

// 2. Open the PPTX as a zip archive
using (ZipArchive archive = ZipFile.Open("NewReportName.pptx", ZipArchiveMode.Update))
{
    // Locate the chart part that contains the externalWorkbookPath
    var chartEntry = archive.GetEntry("ppt/charts/chart1.xml"); // adjust the name as needed
    if (chartEntry != null)
    {
        string xml;
        using (var reader = new StreamReader(chartEntry.Open()))
            xml = reader.ReadToEnd();

        // Replace the absolute URI with the relative name
        xml = xml.Replace(@"file:///usr/lib/NewReportName.xlsx", "NewReportName");

        // Write the modified XML back
        using (var writer = new StreamWriter(chartEntry.Open()))
            writer.Write(xml);
    }
}

Caution: This approach bypasses the SDK’s validation layer. Ensure that the final PPTX is tested in the target PowerPoint version.


Feature Request Status

Your request for native support of relative external workbook paths has been logged with our product team.

  • Ticket ID: SLIDES‑REQ‑2025‑0012
  • Planned action: Investigation of adding an overload or a new property that allows the caller to indicate that the supplied path is already a relative reference and should be written verbatim.

At this time, no release date can be promised, but the request is being tracked for future releases.


What You Can Do Now

  1. Continue using the SDK to generate and update the chart data as you already do.
  2. After saving the presentation, apply the lightweight XML post‑process shown above (or a similar method) to replace the absolute URI with the desired relative name.
  3. Let us know the outcome – if you encounter any issues with the XML edit, we can help fine‑tune the script for your specific chart layout.

References


Next Steps

If you need a ready‑to‑use utility that performs the XML fix automatically for all charts in a presentation, please let us know and we can provide a small helper class.

Thank you for bringing this to our attention. We appreciate your patience while we evaluate the enhancement. If you have any further questions or need assistance with the post‑processing script, feel free to reply.

@karl.sjostrand,
Please note that the PPTX format does not support relative paths for Excel files linked to PowerPoint charts. That is why Aspose.Slides does not provide this possibility. However, the legacy binary PPT format still supports this feature.

Manage Chart Workbooks in Presentations in .NET|Aspose.Slides Documentation