本文将介绍如何使用Spire.Presentation for Java设置PowerPoint表格的行高和列宽。
原文档如下:
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 {
//加载PowerPoint文档
Presentation ppt = new Presentation();
ppt.loadFromFile("Table.pptx");
//获取第一张幻灯片
ISlide slide = ppt.getSlides().get(0);
//获取幻灯片上的表格
ITable table = (ITable) slide.getShapes().get(0);
//改变表格第一行的行高和第一列的列宽
table.getTableRows().get(0).setHeight(100);
table.getColumnsList().get(0).setWidth(250);
//保存文档
ppt.saveToFile("Output.pptx", FileFormat.PPTX_2013);
ppt.dispose();
}
}
结果文档: