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.

Wed Jun 20, 2018 9:37 am

Well, the problem is that it says "Blackadder ITC", but in fact it's not.(NotBlackaddder.jpg)
If you know "Blackadder ITC", It looks like this: (TotallyBlackaddder.jpg)



Jane.Bai wrote:Hello,

Sorry that I'm not clear about your intention. I found that the font of the chart legend in "test.pptx" is "Blackadder ITC" rather than Calibri. And what indeed did you do? Get the font and font style and then reset the font? I tried that yet didn't encounter any issue. Please share the entire code and point out the issue.
Below is my testing code.
Code: Select all
Presentation ppt = new Presentation();
ppt.LoadFromFile(diag.FileName);
IChart Chart = null;
foreach (Shape shp in ppt.Slides[0].Shapes)
{
    if (shp is IChart)
    {
        Chart = shp as IChart;
    }
}
var textParagraph = Chart.ChartLegend.TextProperties.Paragraphs[0];
Font font = GetFont(textParagraph);
FontStyle fStyle = GetFontStyle(textParagraph.DefaultCharacterProperties);
textParagraph.DefaultCharacterProperties.LatinFont = new TextFont("Arial Unicode MS");
ppt.SaveToFile("123.pptx", FileFormat.Pptx2010);


Sincerely,
Jane
E-iceblue support team

rokaf
 
Posts: 37
Joined: Thu May 10, 2018 9:30 am

Wed Jun 20, 2018 11:18 am

Hello,

In fact, the font of each legend entry is still the default font. You could check that by clicking on a certain entry.
default.png

After an in-depth investigation, we found that the previous method for changing the legend font has some problem. I indeed reproduced the issue you mentioned using that code.
Now, please use the following correct code to set the font instead.
Code: Select all
foreach(TextCharacterProperties entrypry in Chart.ChartLegend.EntryTextProperties)
{
    entrypry.LatinFont = new TextFont("Blackadder ITC");
}


And this code to get the font.
Code: Select all
foreach(TextCharacterProperties entrypry in Chart.ChartLegend.EntryTextProperties)
{
    var font = entrypry.LatinFont;
}

BTW, still need to mention that the default font would return null. Please set a certain font first and then get it.
So sorry for the inconvenience caused.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri Jun 22, 2018 1:37 pm

Thanks a lot!
It works now.

Jane.Bai wrote:Hello,

In fact, the font of each legend entry is still the default font. You could check that by clicking on a certain entry.
default.png

After an in-depth investigation, we found that the previous method for changing the legend font has some problem. I indeed reproduced the issue you mentioned using that code.
Now, please use the following correct code to set the font instead.
Code: Select all
foreach(TextCharacterProperties entrypry in Chart.ChartLegend.EntryTextProperties)
{
    entrypry.LatinFont = new TextFont("Blackadder ITC");
}


And this code to get the font.
Code: Select all
foreach(TextCharacterProperties entrypry in Chart.ChartLegend.EntryTextProperties)
{
    var font = entrypry.LatinFont;
}

BTW, still need to mention that the default font would return null. Please set a certain font first and then get it.
So sorry for the inconvenience caused.

Sincerely,
Jane
E-iceblue support team

rokaf
 
Posts: 37
Joined: Thu May 10, 2018 9:30 am

Mon Jun 25, 2018 1:26 am

Hello,

Thank you for your feedback.
Just feel free to contact us if you need any assistance.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.Presentation