Java set table style for the PowerPoint table

With Spire.Presentation for Java, we can format a table by applying preset table styles. This article will demonstrate how to apply predefined styles to a table on presentation slides.

Firstly, view the table on the PowerPoint document:

Java set table style for the PowerPoint table

import com.spire.presentation.ITable;
import com.spire.presentation.Presentation;
import com.spire.presentation.FileFormat;
import com.spire.presentation.TableStylePreset;

public class SetTableStyle {
    public static void main(String[] args) throws Exception {

        //Create a PPT document and load file
        Presentation presentation = new Presentation();

        ITable table = null;

        for (Object shape : presentation.getSlides().get(0).getShapes()) {
            if (shape instanceof ITable) {
                table = (ITable) shape;
                //Set the table style from TableStylePreset and apply it to selected table
        //Save the file
       presentation.saveToFile("SetTableStyle.pptx", FileFormat.PPTX_2010);


Effective screenshot after updating the table style:

Java set table style for the PowerPoint table