Not able to change font size and font type of chart title

Hi,

I am not able to change the font style and size of chart title.
here i am providing the source code:


Presentation pres = new Presentation();

//Access first slide
ISlide sld = pres.Slides[0];

// Add chart with default data
IChart chart = sld.Shapes.AddChart(ChartType.ClusteredColumn, 0, 0, 500, 500);
chart.PlotArea.Height = 0.5f;
chart.ChartTitle.AddTextFrameForOverriding(“Sample Title”);
chart.ChartTitle.TextFrameForOverriding.TextFrameFormat.CenterText = NullableBool.True;
chart.ChartTitle.TextFormat.PortionFormat.FontHeight = 10f;
chart.ChartTitle.TextFormat.PortionFormat.LatinFont = new FontData(“Arial”);
chart.HasTitle = true;

//Set first series to Show Values
chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowValue = true;

//Setting the index of chart data sheet
int defaultWorksheetIndex = 0;

//Getting the chart data worksheet
IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;

//Delete default generated series and categories
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();
int s = chart.ChartData.Series.Count;
s = chart.ChartData.Categories.Count;

//Adding new series
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 1, “Series 1”), ChartType.ClusteredColumn);
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 2, “Series 2”), ChartType.StackedColumn);
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 3, “cagr”), ChartType.Line);

//Adding new categories
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 1, 0, “Caetegoty 1”));
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 2, 0, “Caetegoty 2”));
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 3, 0, “Caetegoty 3”));

//Take first chart series
IChartSeries series = chart.ChartData.Series[0];

// Now populating series data

series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 1, -20));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 1, 50));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 3, 1, 30));

chart.ChartData.Series[0].PlotOnSecondAxis = true;
//Setting fill color for series
series.Format.Fill.FillType = FillType.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Red;
chart.ChartData.Series[0].InvertIfNegative = false;
chart.ChartData.Series[1].InvertIfNegative = false;
chart.ChartData.Series[2].InvertIfNegative = false;
//Take second chart series
series = chart.ChartData.Series[1];

//Now populating series data
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 2, 30));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 2, 10));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 3, 2, 60));

//Setting fill color for series
series.Format.Fill.FillType = FillType.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Green;
series = chart.ChartData.Series[2];
series.DataPoints.AddDataPointForLineSeries(fact.GetCell(defaultWorksheetIndex, 1, 3, “”));
series.DataPoints.AddDataPointForLineSeries(fact.GetCell(defaultWorksheetIndex, 2, 3, 50));
series.DataPoints.AddDataPointForLineSeries(fact.GetCell(defaultWorksheetIndex, 3, 3, 50));
series.Format.Fill.FillType = FillType.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Olive;
chart.DisplayBlanksAs = DisplayBlanksAsType.Gap;
chart.ChartData.Series[0].PlotOnSecondAxis = true;
pres.Save(“C:\Presentations\AsposeChart.pptx”, Aspose.Slides.Export.SaveFormat.Pptx);

Hi Deepak,


I have observed your requirements. I request to you please use the Aspose.Slides for .NET 16.6.0 version on your end. I request to you please share feedback with us if there is still an issue and also share the source presentation so that we may investigate on our end.

Best Regard,

I updated the aspose slide to 16.6.0 version but still getting the same issue.Not able to change font style and font size of chart title.

Hi Deepak,


I have observed your comments. I request to you please share the source presentation so that we may further investigate on our end.

Best Regard,

Hi,

I am attaching the presentation file
In the code i have set the font as ‘Arial’ and font size as 10 but its not reflection in the ppt.
H Deepak,

I have worked with the presentation shared by you using Aspose.Slides for .NET 16.6.0 and have been able to observe the issue. A ticket with ID
SLIDESNET-37713 has been added in our issue tracking system to resolve the issue. This thread has been associated with the ticket so that we share notification with you once issue will be fixed.

We are sorry for your inconvenience,

Hi Deepak,

I have worked over your code and suggest you to please add following lines in your code and replace them with existing ones where you are setting chart title. I hope this will work on your end.

ITextFrame frm = chart.ChartTitle.AddTextFrameForOverriding(“Sample Title”);
IPortion chartTitle = frm.Paragraphs[0].Portions[0];
chartTitle.PortionFormat.LatinFont = new FontData(“Arial”);
chartTitle.PortionFormat.FillFormat.FillType = FillType.Solid;
chartTitle.PortionFormat.FillFormat.SolidFillColor.Color = Color.Gray;
chartTitle.PortionFormat.FontHeight = 10f;

Many Thanks,