Evenly Distribute Rows and Columns in PowerPoint Table in Java

This article demonstrates how to evenly distribute the rows and columns of a PowerPoint table using Spire.Presentation for Java.

The input document:

Evenly Distribute Rows and Columns in PowerPoint Table in Java

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

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

        //Get the first slide
        ISlide slide = ppt.getSlides().get(0);
        //Get the table in the slide
        ITable table = (ITable) slide.getShapes().get(0);
        //Distribute table rows
        table.distributeRows(0,4);
        //Distribute table columns
        table.distributeColumns(0,4);

        //Save the result document
        ppt.saveToFile("DistributeRowsAndColumns.pptx", FileFormat.PPTX_2013);
    }

The output document:

Evenly Distribute Rows and Columns in PowerPoint Table in Java