We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to change the font of all the text in the ppt to another desired font

Hi Team,

Can you please tell me how do I change the font type of each and every letter in the PPT to some other font via .net code.
I want to change all the letters to the desired font.

Ex I uploaded a PPT to my system which has different random fonts used everywhere and I don’t know the names of those fonts. I want to change the font of every letter including the headers and footers to 1 consistent font to VERDANA.

Can you please tell me the way to do it in .net?? If possible please provide me the code snippet.

Thanks
Jay

@jayjain,

I have observed your requirements related to fonts replacement for text in presentation. I suggest you to please visit documentation article, Replacing Fonts Explicitly for your convenience. I hope the shared information will be helpful.

@mudassir.fayyaz Thanks for your help but the F() ReplaceFont does require me to tell which Font I want to replace. Actually, my ppt file will have lots of different FONTS used. I want to convert all of them to 1 CONSISTENT FONT throughout the report in a go. I cannot specify which fonts to replace but I can just tell which font I want to use in my entire PPT.

the code given in Replacing Fonts Explicitly looks like
Presentation presentation = new Presentation(dataDir + “Fonts.pptx”);

// Load source font to be replaced **_Idont want to tell the system which font to Replace but I just want to tell the system that CONVERT ALL THE FONT IN THE PPT TO "VERDANA"**_
IFontData sourceFont = new FontData("Arial");

// Load the replacing font 
IFontData destFont = new FontData("Times New Roman");

// Replace the fonts
**presentation.FontsManager.ReplaceFont(sourceFont, destFont);**

CAN YOU PLEASE HELP ME…

@jayjain,

In that case you need to access the list of fonts used in presentation and set the replacement for individual font. The following sample code shall be helpful in this regard.

// Load the replacing font 
IFontData destFont = new FontData("Times New Roman");

var usedFonts = dstPres.FontsManager.GetFonts();
foreach (var sourceFont in usedFonts)
{
    // Replace the fonts
    dstPres.FontsManager.ReplaceFont(sourceFont, destFont);
}