Editable Chart Export in PPT

Hi Team,

Recently we had explored Aspose.Cells for .NET and purchased licensed version and successfully running in our server…
Currently we have another scenario - need to download charts from UI in ppt. But the check is chart should be editable one in ppt with it’s data and not as image…
Is aspose.slides support this editable charts in ppt?

Regards,
Kalaiselvan R

@kalai328,
Thank you for the query. Yes, Aspose.Slides supports the editable charts. Please take a look at the following simple code example (C#):

using (var presentation = new Presentation())
{
    ISlide slide = presentation.Slides[0];
    IChart chart = slide.Shapes.AddChart(ChartType.ClusteredColumn, 20, 20, 600, 300);

    // change data and formatting here

    presentation.Save(dataPath + "example.ppt", SaveFormat.Ppt);
}

Documents: Create Chart, PowerPoint Charts, Chart Formatting
API Reference: ShapeCollection.AddChart Method, ChartType Enumeration

Hey Andrey,

Yes - Its known that Charts can be edited and formatted before binding into PPT.

But my concern is - After Downloading Chart content into PPT with data.
In PPT - is there a way to edit chart based on data? - Like this customized Chart in PPT is able to be downloaded through Aspose.Slides for .NET?

Regards,
Kalaiselvan R

@kalai328,
To clarify your requirements, could you describe more details, please?

@Andrey_Potapov:

From UI - we have set of Charts in each section. (Ex: Section1 - Line Chart, Section2 - Bar Chart, Section3 - Pie Chart, Section4 - Sunburst Chart).
UI its bind thru - API’s with Json Data for each Section Chart.

  1. Have a Requirement - To Export these Charts into PPT
  2. Where the PPT - should not be a image copy - Its should be a Chart (So the same chart Component need to be created in .net API and exported to PPT, Know that few chart types will wont support).
  3. And this PPT chart need to be exported with Data (JSON or Object or Table or Excel). So that user can download the PPT and can able to play with data to modify chart component.

Hope the above content will be helpful - And let me know if any more details required.

Regards,
Kalaiselvan R

@kalai328,
Aspose.Slides adds charts to presentations as PowerPoint elements that are not images. Chart data is stored in an embedded Excel table. So your users can open these presentations and change chart data for their purposes.

Thanks @Andrey_Potapov for the confirmation…
And hope it suits my requirements…

Can you help me to share any sample code for bar or line chart which adds to presentation through .net c#.

I had downloaded latest Aspose.Slides .net DLL for trial purpose…

@kalai328,
The code example below shows adding Line chart and Stacked Bar chart:

using (var presentation = new Presentation())
{
    ISlide firstSlide = presentation.Slides[0];
    ISlide secondSlide = presentation.Slides.AddClone(firstSlide);

    IChart lineChart = firstSlide.Shapes.AddChart(ChartType.Line, 20, 20, 600, 300);
    IChart barChart = secondSlide.Shapes.AddChart(ChartType.StackedBar, 20, 20, 600, 300);

    presentation.Save(dataPath + "example.pptx", SaveFormat.Pptx);
}

More examples you can find by the links above.

@Andrey_Potapov:

Restarting my POC stuffs with Aspose Slides. And now i may need to bind JSON to Editable Chart.
Can you share any sample code used to bind a Json.
Ex: Series1 - Month-Year
Series2-Have its values.
Then my JSON will be like {[“month” : “Apr 2020”,“Value”:104],[“month” : “May2020”,“Value”:105], etc…}

Using above JSON its possible to bind all types of MSO charts which is available in Aspose Slides.

@kalai328,
I will answer you as soon as possible.

@kalai328,
If I understand correctly, you would like to update a chart automatically when a JSON data file is changed. Right? The sources of data for charts are Excel files that are embedded in presentation files. Unfortunately, I don’t see a way to bind JSON data to charts in PowerPoint presentations that don’t have this capability. But you can parse your JSON data yourself and fill the chart data depending on a chart type.

Partially right.
No change once exporting data into PPT. In PPT chart data can changed only thru excel file as you mentioned.

My query is
Input : JSON data.
Output : Chart data binded thru JSON and exported to PPT as editable version.

@kalai328,
What do you mean by “binded”?

Binded - I mean extracting Chart data from JSON as an input.
Source - Can be Static or Table or Excel or JSON. In My Requirement source will be from JSON.

Input: {[“month” : “Apr 2020”,“Value”:104],[“month” : “May2020”,“Value”:105], etc…}
Output: Exporting PPT with Editable Chart from above data.

@kalai328,
What exactly kind of difficulties do you have in parsing JSON data and filling in data for charts?