Managing Font Family of Text in PHP

Aspose.Slides - Managing Font Family of Text

To Manage Font Family of Text using Aspose.Slides Java for PHP, call font_family_of_text method of TextFont module. Here you can see example code.


     public static function font_family_of_text($dataDir=null){

        # Create an instance of Presentation class

        $pres = new Presentation();

        # Get the first slide

        $sld = $pres->getSlides()->get_Item(0);

        # Add an AutoShape of Rectangle type

        $shapeType=new ShapeType();

        $ashp = $sld->getShapes()->addAutoShape($shapeType->Rectangle, 50, 50, 200, 50);

        # Remove any fill style associated with the AutoShape

        $fillType=new FillType();


        # Access the TextFrame associated with the AutoShape

        $tf = $ashp->getTextFrame();

        $tf->setText("Aspose TextBox");

        # Access the Portion associated with the TextFrame

        $port = $tf->getParagraphs()->get_Item(0)->getPortions()->get_Item(0);

        # Set the Font for the Portion

        $port->getPortionFormat()->setLatinFont(new FontData("Times New Roman"));

        # Set Bold property of the Font

        $nullableBool=new NullableBool();


        # Set Italic property of the Font


        # Set Underline property of the Font

        $textUnderlineType=new TextUnderlineType();


        # Set the Height of the Font


        # Set the color of the Font

        $color=new Color();



        # Write the presentation as a PPTX file

        $save_format = new SaveFormat();

        $pres->save($dataDir . "FontFamilyOfText.pptx", $save_format->Pptx);

        print "Done with font family for text, please check the output file.".PHP_EOL;


Download Running Code

Download Managing Font Family of Text (Aspose.Slides) from any of the below mentioned social coding sites: