when I try to get chart legend font size from chart.ChartLegend.EntryTextProperties[index].FontHeight is NAN because of this generated pptx from this template gives the wrong font size.
Template legend size is 12 bu generated is 9.
- Code: Select all
//Load template presentation
Presentation templatePresentation = new Presentation();
//templatePresentation.LoadFromFile("template-overlays.pptx");
templatePresentation.LoadFromFile("Presentation1.pptx");
//Create New Presentation
Spire.Presentation.Presentation presentation = new Spire.Presentation.Presentation();
presentation.Slides.RemoveAt(0);
//Get slide from template presentation. index:1
ISlide cloneSlide = templatePresentation.Slides.ToArray().ElementAtOrDefault(0);
//---
//Get Chart
IChart chart = cloneSlide.Shapes.ToArray().FirstOrDefault(x => x.Name == "Chart 14") as IChart;
var firstLegendFontSize=chart.ChartLegend.EntryTextProperties[0].FontHeight;
var secondLegendFontSize = chart.ChartLegend.EntryTextProperties[1].FontHeight;
presentation.Slides.Append(cloneSlide);
//Save and launch to view the PPTX document.
presentation.SaveToFile("Test.pptx", Spire.Presentation.FileFormat.Pptx2013);