Presentation Notes

Aspose.Slides for PHP via Java provides the feature of removing notes of any slide as well as add style to existing notes. Developers can remove notes in the following ways:

  • Remove Notes of a Specific Slide of a presentation.
  • Remove Notes of All Slides of a Presentation

Remove Notes from Slide

Notes of some specific slide could be removed as shown in example below:

  # Instantiate a Presentation object that represents a presentation file
  $pres = new Presentation("presWithNotes.pptx");
  try {
    # Removing notes of first slide
    $mgr = $pres->getSlides()->get_Item(0)->getNotesSlideManager();
    $mgr->removeNotesSlide();
    # Saving presentation to disk
    $pres->save("test.pptx", SaveFormat::Pptx);
  } finally {
    if (!java_is_null($pres)) {
      $pres->dispose();
    }
  }

Remove Notes from Presentation

Notes of all the slides of a presentation could be removed as shown in example below:

  # Instantiate a Presentation object that represents a presentation file
  $pres = new Presentation("presWithNotes.pptx");
  try {
    # Removing notes of all slides
    $mgr = null;
    for($i = 0; $i < java_values($pres->getSlides()->size()) ; $i++) {
      $mgr = $pres->getSlides()->get_Item($i)->getNotesSlideManager();
      $mgr->removeNotesSlide();
    }
    # Saving presentation to disk
    $pres->save("test.pptx", SaveFormat::Pptx);
  } finally {
    if (!java_is_null($pres)) {
      $pres->dispose();
    }
  }

Add NotesStyle

getNotesStyle method has been added to IMasterNotesSlide interface and MasterNotesSlide class respectively. This property specifies the style of a notes text. The implementation is demonstrated in the example below.

  # Instantiate a Presentation object that represents a presentation file
  $pres = new Presentation("demo.pptx");
  try {
    $notesMaster = $pres->getMasterNotesSlideManager()->getMasterNotesSlide();
    if (!java_is_null($notesMaster)) {
      # Get MasterNotesSlide text style
      $notesStyle = $notesMaster->getNotesStyle();
      # Set symbol bullet for the first level paragraphs
      $paragraphFormat = $notesStyle->getLevel(0);
      $paragraphFormat::getBullet()->setType(BulletType::Symbol);
    }
    $pres->save("NotesSlideWithNotesStyle.pptx", SaveFormat::Pptx);
  } finally {
    if (!java_is_null($pres)) {
      $pres->dispose();
    }
  }