PowerPoint - Populating Data Tags with Data from Another File in C#

Hiya,

I have been testing this but not sure if it is possible. I have a PowerPoint file with a chart, I right click and Edit Data and use the tag <<[test]>> and then try to populate this tag with a value and cannot get this to work.

I have tried ‘Replacing Text’ searching for the same tag and value but Populating and Replacing doesn’t seem to ‘see’ these tags to then replace it with the value I am asking it to. Not sure if its possible making the values dynamic this way

I suppose another question I have regarding this is can you replace a single value or use a foreach to populate the excel values IN Powerpoint. (The use case is populating a PP chart with values/data from an Excel file)

@Kayleigh,
Thank you for posting the questions. I need some time to answer them. I will get back to you as soon as possible.

@Kayleigh,
Please try using the following code snippet:

var dataTag = "<<[test]>>";
var dataValue = 777;

using var presentation = new Presentation("sample.pptx");

// Let's assume there is at least one slide and one chart in the presentation.
var chart = (IChart)presentation.Slides[0].Shapes[0];

var worksheetIndex = 0;
var rowIndex = 1;
var columnIndex = 1;

var cell = chart.ChartData.ChartDataWorkbook.GetCell(
    worksheetIndex, rowIndex, columnIndex);

var cellValue = cell.Value.ToString();

if (cellValue.ToString() == dataTag)
{
    cell.Value = dataValue;
}

presentation.Save("output.pptx", SaveFormat.Pptx);

You can also use the String.Replace method if you need to work with string values:

// The dataValue is string here.
cell.Value = cellValue.Replace(dataTag, dataValue);

Hello, Thank you for your response.

Apologies on my end as I should have provided more context - I am working with LINQ engine, to pass the file and values.

This is the Apose documentation I have been trying to apply the logic for -
Working with Charts in C#|Aspose.Words for .NET

The attached screenshot is an example inside my PowerPoint template with tags, those tags are reference in a separate Excel spreadsheet with values and I am simply trying to populate PowerPoint with these values but I cannot seem to get this working. I created a separate PowerPoint file, added 1 chart and tried to do this for 1 value with no link to an excel, and this still wouldn’t work.

Hope this makes more sense.
image.png (31.0 KB)

@Kayleigh,
I need some time to understand your requirements. I will get back to you as soon as possible. Thank you for your patience.

@Kayleigh,
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESNET-45190

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.

Hello

Many thanks for your time and looking into this.

If an internal ticket has been raised are you able to confirm if this is a bug or something that is currently not supported?

@Kayleigh,
The LINQ Reporting Engine feature is not supported by Aspose.Slides, and implementing it would require significant effort.