Free Support Forum - aspose.com

Two Diffrent Font Size in Chart Title

Hello Team,
We have Aspose.Cell 4.5.0.0. We are creating charts in Excel.
In Chart Title we need to Give two different type of Font size and Font name.

for example in the first line we need : Report for (Font:verdana, size 18 and then Break(\n) in the second line we need : Oct 2008 - Oct 2009(Font:verdana, size 14).

Please guide me how we can fix this.

Thanks
- Patrick

Hi,

Thanks for your inquiry.

Since you are using some older version, so I am not sure if it supports to set selected characters font attributes for a chart’s title. Please see the following piece of code with the attached version for your scenario, I have tested with it and it works just fine.

Sample code:

//Set properties of chart title
chart.Title.Text = “Testing my Chart Title1 \nOct 2008 - Oct 2009”;
//Set the first line formatting.
chart.Title.Characters(0, 24).Font.Name = “Verdana”;
chart.Title.Characters(0, 24).Font.Size = 18;
//Set the second line formatting.
chart.Title.Characters(25, 20).Font.Color = Color.Blue;
chart.Title.Characters(25, 20).Font.Name = “Verdana”;
chart.Title.Characters(25, 20).Font.Size = 14;


Thank you.