Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Tue Jul 03, 2018 9:31 am

Hi,

I cannot seem to be able to create a simple PieChart.

I've created a project demonstrating the problem.

It adds a slide, and tries to set the ChartData from a constructed datatable (1 row, 4 columns).
File is saved without a problem, but the file cannot be opened by PowerPoint which reports it as corrupt.

If I create a presentation with a chart that has default data in it, it is working.

Please help!

Kind regards
Mattias

mattias.skog@evry.com
 
Posts: 1
Joined: Tue Jul 03, 2018 8:34 am

Tue Jul 03, 2018 10:28 am

Dear Mattias,

Thanks for your inquiry.
After checking your code, I thought the cause of your issue was that there were some wrong code when binding the data for chart. I changed your code to below code, then I could get correct chart.
Code: Select all
            chart.Series.SeriesLabel = chart.ChartData["B1", "B1"];
            chart.Categories.CategoryLabels = chart.ChartData["B1", "D1"];
            chart.Series[0].Values = chart.ChartData["B2", "D2"];

If this is not what you want, please share your expected result for further investigation.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Jul 04, 2018 6:46 am

That solved the problem with the piechart.

I do however have an intermittent error rendering the piechart with Index out of range when saving the file.
Trying to produce a reproducible project.

System.IndexOutOfRangeException: 'Index was outside the bounds of the array'

when calling this:
presentation.SaveToFile("c:\\temp\\not_working23.pptx", FileFormat.Pptx2013);

ST:
at spr⇍.ᜀ(Int32 A_0)
at spr⤐.ᜁ(spr⇍ A_0, String A_1, String A_2, Int32 A_3)
at sprⅆ.ᜀ(spr⭙ A_0)
at spr៞.ᜀ(spr⦠ A_0)
at spr₵.ᜀ(spr➸ A_0)
at sprᨧ.ᜀ(spr➸ A_0)
at sprᨧ.ᜁ(Stream A_0)
at sprᦀ.᜘()
at sprᦀ.ᜀ(spr➸ A_0)
at Spire.Presentation.Collections.ShapeList.ᜀ(spr➸ A_0)
at Spire.Presentation.GroupShape.PptxPrepareForSaving(spr➸ saveContext)
at Spire.Presentation.ActiveSlide.PresentationBeforeSave(spr➸ saveContext)
at sprⲷ.ᜀ(spr➸ A_0)
at sprᲓ.ᜀ(spr➸ A_0, spr⫴ A_1)
at sprᲓ.ᜀ(Stream A_0, spr⫴ A_1, sprᢺ A_2)
at sprᲓ.ᜀ(Stream A_0, spr⒚ A_1, sprᩀ A_2)
at sprᲓ.ᜀ(String A_0, spr⒚ A_1)
at Spire.Presentation.Presentation.SaveToFile(String file, FileFormat fileFormat)

mattias
 
Posts: 1
Joined: Tue Jul 03, 2018 10:10 am

Wed Jul 04, 2018 7:04 am

Dear mattias,

Thanks for your information.
I am looking forward to your sample project which could reproduce your issue.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Jul 06, 2018 8:48 am

Dear mattias,

How is your issue going now ? Could you please provide a sample project which could reproduce your issue ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Presentation