C# 操作PPT图形

2025-05-13 05:43:45

1、下载并安装Spire.Presentation for .NET, 并将Spire.Presentation.dll文件引用到项目中。

2、将代码放入Visual Studio中:旋转图形【C#】using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using Spire.Presentation;namespace Rotate_Shapes{ class Program { static void Main(string[] args) { //创建一个PowerPoint文档并加载示例文档 Presentation ppt = new Presentation(); ppt.LoadFromFile("Sample.pptx"); //获取第一个幻灯片里的第一个图形 IShape shape = ppt.Slides[0].Shapes[0]; //旋转180度 shape.Rotation = 180; //保存文档 ppt.SaveToFile("Rotate.pptx", FileFormat.Pptx2010); } }}

3、前后效果对不图如下:

C# 操作PPT图形
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢