Aspose.Slides.NET 23.1.0
When a chart embedded on a slide has a link to a file hosted at an inaccessible URL rather than in the local file system, attempting to read from the chart data causes an InvalidOperationException with an inner WebException containing the http status code such as (403, 404 etc) despite using the RecoverWorkbookFromChartCache spreadsheet load option documented here.
The following code can be used to reproduce the error,
void Main()
{
var loadOptions = new LoadOptions { SpreadsheetOptions = new SpreadsheetOptions { RecoverWorkbookFromChartCache = true };
using var presentation = new Presentation(loadOptions);
var chart = presentation.Slides[0].Shapes.AddChart(ChartType.Pie, 50, 50, 400, 600);
chart.ChartData.SetExternalWorkbook("https://example.com/example.xlsx", false);
var workbook = chart.ChartData.ChartDataWorkbook;
}
The same issue occurs when loading from PPTX file.
I have been able to make RecoverWorkbookFromChartCache work in this scenario by setting the external workbook to an invalid file path URI instead, using, chart.ChartData.SetExternalWorkbook("file:///should-not.exist", false);
I believe the above workaround shouldn’t be necessary when using RecoverWorkbookFromChartCache.