News Category

Set Table Row Height and Column Width in PowerPoint in Java

2019-02-21 08:05:35 Written by  support iceblue
Rate this item
(0 votes)

This article demonstrates how to set the row height and column width of an existing table in a PowerPoint document using Spire.Presentation for Java.

Below is the screenshot of the input PowerPoint document:

Set Table Row Height and Column Width in PowerPoint in Java

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

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

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

        //Get the first table in the slide
        ITable table = (ITable) slide.getShapes().get(0);

        //Change the height of the first table row and the width of the first table column
        table.getTableRows().get(0).setHeight(100);
        table.getColumnsList().get(0).setWidth(250);

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

Output:

Set Table Row Height and Column Width in PowerPoint in Java

Additional Info

  • tutorial_title:
Last modified on Thursday, 02 September 2021 06:03