Manage Text Portions in Presentations Using PHP

Get Position Coordinates of Portion

getCoordinates() method has been added to IPortion and Portion class which allows retrieving the coordinates of the beginning of the portion.

  # Instantiate Prseetation class that represents the PPTX
  $pres = new Presentation();
  try {
    # Reshaping the context of presentation
    $shape = $pres->getSlides()->get_Item(0)->getShapes()->get_Item(0);
    $textFrame = $shape->getTextFrame();
    foreach($textFrame->getParagraphs() as $paragraph) {
      foreach($paragraph->getPortions() as $portion) {
        $point = $portion->getCoordinates();
        echo("X: " . $point->$x . " Y: " . $point->$y);
      }
    }
  } finally {
    if (!java_is_null($pres)) {
      $pres->dispose();
    }
  }