Aspose.Slides.Examples.CSharp.Text.ReplaceFontsExplicitly.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();
           
            // ExStart:ReplaceFontsExplicitly
            // Load presentation
            Presentation presentation = new Presentation(dataDir + "Fonts.pptx");

            // Load source font to be replaced
            IFontData sourceFont = new FontData("Arial");

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

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

            // ExEnd:ReplaceFontsExplicitly
            // Save the presentation
            presentation.Save(dataDir + "UpdatedFont_out.pptx", SaveFormat.Pptx);
        }
    }
ReplaceFontsExplicitly