PPT控件Spire.Presentation 教程:在PPT中设置表行高度和列宽度

以下屏幕截图显示了设置行高和列宽之前的表。

图片1

详细步骤:

Step 1: 实例化Presentation对象并加载PowerPoint文档。

Presentation ppt = new Presentation();ppt.LoadFromFile("Input.pptx");

Step 2: 获得第一张幻灯片。

ISlide slide = ppt.Slides[0];

Step 3:获取幻灯片上的第一张表。

ITable table = ppt.Slides[0].Shapes[0] as ITable;

Step 4:设置表行高和列宽。

table.TableRows[1].Height = 50;table.ColumnsList[1].Width = 100;

Step 5:保存文档。

ppt.SaveToFile("Output.pptx", FileFormat.Pptx2013);

截图:

图片2

完整代码:

[C#]

using Spire.Presentation;namespace Set_table_column_width_and_row_height{    class Program    {        static void Main(string[] args)        {            Presentation ppt = new Presentation();            ppt.LoadFromFile("Input.pptx");            ISlide slide = ppt.Slides[0];               ITable table = ppt.Slides[0].Shapes[0] as ITable;            table.TableRows[1].Height = 50;            table.ColumnsList[1].Width = 100;            ppt.SaveToFile("Output.pptx", FileFormat.Pptx2013);        }    }}End Namespace

[VB.NET]

Imports Spire.PresentationNamespace Set_table_column_width_and_row_height    Class Program        Private Shared Sub Main(args As String())            Dim ppt As New Presentation()            ppt.LoadFromFile("Input.pptx")            Dim slide As ISlide = ppt.Slides(0)            Dim table As ITable = TryCast(ppt.Slides(0).Shapes(0), ITable)            table.TableRows(1).Height = 50            table.ColumnsList(1).Width = 100            ppt.SaveToFile("Output.pptx", FileFormat.Pptx2013)        End Sub    End Class

控件

标签:文档管理PPT文档处理

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2017年7月7日
下一篇 2017年7月7日

相关推荐

发表回复

登录后才能评论