Set and Get Slide Title in PowerPoint in Java

This article demonstrates how to set and get slide title in a PowerPoint document using Spire.Presentation for Java.

Set slide title

import com.spire.presentation.FileFormat;
import com.spire.presentation.ISlide;
import com.spire.presentation.Presentation;

public class SetSlideTitle {
    public static void main(String[] args) throws Exception {
        //Create a Presentation instance
        Presentation ppt = new Presentation();
        //Get the first slide
        ISlide slide = ppt.getSlides().get(0);
        
        //Set title for the slide
        slide.setTitle("Tile Text");
        
        //Save the result document
        ppt.saveToFile("SetTitle.pptx", FileFormat.PPTX_2013);
    }
}

Set and Get Slide Title in PowerPoint in Java

Get slide title

import com.spire.presentation.ISlide;
import com.spire.presentation.Presentation;

public class GetSlideTitle {
    public static void main(String[] args) throws Exception {
        //Create a Presentation instance
        Presentation ppt = new Presentation();
        //Load a PowerPoint document
        ppt.loadFromFile("SetTitle.pptx");

        //Get the first slide
        ISlide slide = ppt.getSlides().get(0);

        //Print out the title of the slide
        String tile = slide.getTitle();
        System.out.println(tile);
    }
}

Set and Get Slide Title in PowerPoint in Java