Creating TextBox with Hyperlink in PHP

To Create a TextBox with Hyperlink using Aspose.Slides Java for PHP, call create_textbox_with_hyperlink method of CreateTextBox module. Here you can see example code.


     public static function create_textbox_with_hyperlink(){

        $pres = new Presentation();

        # Get the first slide

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

        # Add autoshape of rectangle type

        $shapeType=new ShapeType();

        $pptxShape = $sld->getShapes()->addAutoShape($shapeType->Rectangle, 150, 150, 150, 50);

        # Cast the shape to AutoShape

        $pptxAutoShape = $pptxShape;

        # Access ITextFrame associated with the AutoShape


        $text_frame = $pptxAutoShape->getTextFrame();

        # Add some text to the frame


        #Set Hyperlink for the portion text

        $hypman = $text_frame->getParagraphs()->get_Item(0)->getPortions()->get_Item(0)->getPortionFormat()->getHyperlinkManager();


        # Write the presentation as a PPTX file

        $save_format =new SaveFormat();

        $pres->save(data_dir + "hLinkPPTX.pptx", $save_format->Pptx);

        print "Created TextBox with Hyperlink, please check the output file.".PHP_EOL;


Download Running Code

Download Creating TextBox with Hyperlink (Aspose.Slides) from any of the below mentioned social coding sites: