Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents from any .NET(C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Thu Jan 29, 2015 10:01 am

I installed Spire.Doc to try for using in asp.net mvc application. I need to render charts and to save its for PowerPoint and PDF. I prepare font size for axis and legend before saving(comparison_chart.pptx). I got perfect presentation In PowerPoint but after saving it to pdf (comparison_chart.pdf) legend font size is not set. Pie chart (breakdown_chart.pptx) does not render into pdf at all. The pdf page is clear into breakdown_chart.pdf.

public override object ExportToPPT()
Presentation presentation = new Presentation();
//insert chart
RectangleF rect = new RectangleF(presentation.SlideSize.Size.Width / 2 - 300, 50, 600, 400);
Spire.Presentation.Charts.ChartType chartType;
if (ChartSettings is IPieComponent)
chartType = ChartType.Pie;
chartType = ChartType.ColumnClustered;

IChart chart = presentation.Slides[0].Shapes.AppendChart(chartType, rect, true);

//add chart Title
chart.ChartTitle.TextProperties.Text = ChartSettings.Title;
chart.ChartTitle.TextProperties.IsCentered = true;
chart.ChartTitle.Height = 30;
chart.HasTitle = true;
//Getting data
DataTable data = PrepareData();

InitChartData(chart, data);
chart.Series.SeriesLabel = chart.ChartData[0,1,0,ChartSettings.Values.Count()];
chart.Categories.CategoryLabels = chart.ChartData[1,0,data.Rows.Count,0];

for (int i = 0; i < chart.Series.Count; i++)
chart.Series[i].Values = chart.ChartData[1, 1+i, data.Rows.Count, 1+i];
chart.Series[i].YValues.Add(chart.ChartData[1, 1 + i, data.Rows.Count, 1 + i]);
chart.Series[i].XValues.Add(chart.ChartData[0, 1, 0, ChartSettings.Values.Count()]);

if (ChartSettings.Values.Count() <= 1)
//chart.Series[i].IsVaryColor = true;

if ((DataSource as DataTable).Columns.IndexOf("CustomColor") >= 0)
for (int j = 0; j < chart.Categories.Count; j++)
ChartDataPoint dataPoint = new ChartDataPoint(chart.Series[i]);
//Adding cusom color if exist CustomColor field in DataSource
dataPoint.Fill.SolidColor.Color = System.Drawing.ColorTranslator.FromHtml((string)(DataSource as DataTable).Rows[j]["CustomColor"]);
dataPoint.Index = j;
dataPoint.Fill.FillType = FillFormatType.Solid;

chart.ChartLegend.setEntrys(chart.ChartData[1, 0, 1 + data.Rows.Count - 1, chart.Series.Count]);

foreach (var legendEntryTextProp in chart.ChartLegend.EntryTextProperties)
legendEntryTextProp.FontHeight = 9;

if (chart.PrimaryCategoryAxis != null)
chart.PrimaryCategoryAxis.TextProperties.Paragraphs[0].DefaultCharacterProperties.FontHeight = 9;
if(chart.PrimaryValueAxis != null)
chart.PrimaryValueAxis.TextProperties.Paragraphs[0].DefaultCharacterProperties.FontHeight = 10;

return presentation;

public override object ExportToPDF()
PdfDocument pdf = new PdfDocument();
Presentation presentation = ExportToPPT() as Presentation;
MemoryStream stream = new MemoryStream();
presentation.SaveToFile(stream, Spire.Presentation.FileFormat.PDF);
return pdf;
You do not have the required permissions to view the files attached to this post.

Posts: 1
Joined: Mon Jan 26, 2015 10:54 am

Fri Jan 30, 2015 2:57 am


Thanks for your inquiry.
I have reproduced your issue and forwarded it to our devt team, sorry for the inconvenience. We will inform you when it is resolved.

Feel free to contact us if you have further problems.

Best regards,
E-iceblue support team
User avatar

Posts: 2445
Joined: Wed Jun 27, 2012 8:50 am

Fri Mar 20, 2015 2:53 am


Sorry for long silence. Now the issue has been resolved, you can download the newest hotfix(Spire.Presentation Pack Hotfix Version:2.2.17) and try it.
If there are any questions, welcome to get it back to us.
E-iceblue support team
User avatar

Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Mar 24, 2015 8:29 am


Did Spire.Presentation2.2.17 resolve your issue?
Thanks for your feedback.

Best wishes,
E-iceblue support team
User avatar

Posts: 2445
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Presentation