C# 实现PPT 每一页转成图片过程解析
作者:仰望 星空 时间:2023-02-21 10:01:27
要实现PPT转图片,首先需要引用两个DLL。
我这里用的这个这个版本
Microsoft.Office.Interop.PowerPoint 12.0
Microsoft Office 12.0 object Library
如下图:
代码如下:
private void pptToImg(string pptPath, string imgPath)
{
var app = new Microsoft.Office.Interop.PowerPoint.Application();
var ppt = app.Presentations.Open(pptPath, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse);
var index = 0;
var fileName = Path.GetFileNameWithoutExtension(pptPath);
foreach (Microsoft.Office.Interop.PowerPoint.Slide slid in ppt.Slides)
{
++index;
//设置图片大小
slid.Export(imgPath+string.Format("page{0}.png",index.ToString()), "png", 1024, 768);
//根据屏幕尺寸。设置图片大小
//slid.Export(imgPath+string.Format("page{0}.jpg",index.ToString()), "jpg", Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
}
//释放资源
ppt.Close();
app.Quit();
GC.Collect();
}
来源:https://www.cnblogs.com/ywtk/archive/2013/09/02/3295973.html
标签:C#,ppt,转,图片
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Java实现添加,读取和删除Excel图片的方法详解
2023-11-27 06:29:33
![](https://img.aspxhome.com/file/2023/8/60328_0s.png)
Spring boot2X负载均衡和反向代理实现过程解析
2023-02-06 04:18:53
![](https://img.aspxhome.com/file/2023/2/60612_0s.png)
java实现图片反色处理示例
2022-07-09 20:53:34
![](https://img.aspxhome.com/file/2023/6/110926_0s.jpg)
Java 实现简单静态资源Web服务器的示例
2021-06-16 17:12:55
浅谈Java与C#的一些细微差别
2022-09-25 06:33:36
java实现Dijkstra算法
2021-09-02 23:14:15
![](https://img.aspxhome.com/file/2023/6/97976_0s.jpg)
Android实现按钮点击效果
2021-06-10 10:05:54
java 读取网页内容的实例详解
2023-11-27 22:38:11
C#中异步Socket通信编程代码实例
2022-02-23 11:29:59
![](https://img.aspxhome.com/file/2023/5/129745_0s.png)
C#使用HttpPost请求调用WebService的方法
2022-02-24 07:22:16
![](https://img.aspxhome.com/file/2023/8/89848_0s.png)
IOS开发向右滑动返回前一个页面功能(demo)
2021-09-23 04:30:11
![](https://img.aspxhome.com/file/2023/5/96015_0s.gif)
C#实现密码验证与输错密码账户锁定
2022-04-05 13:22:22
WPF+SkiaSharp实现自绘弹幕效果
2022-09-30 09:52:38
![](https://img.aspxhome.com/file/2023/6/98186_0s.gif)
Java 读取PDF中的文本和图片的方法
2021-09-17 03:05:12
![](https://img.aspxhome.com/file/2023/8/85548_0s.jpg)
C#实现向函数传递不定参数的方法
2021-06-21 01:33:22
使用java springboot设计实现的图书管理系统(建议收藏)
2023-11-25 00:54:49
![](https://img.aspxhome.com/file/2023/8/59928_0s.jpg)
Java 线程对比(Thread,Runnable,Callable)实例详解
2022-10-20 21:34:08
![](https://img.aspxhome.com/file/2023/5/75765_0s.png)
Hibernate实现悲观锁和乐观锁代码介绍
2022-04-25 09:43:45
Intellij IDEA创建spring-boot项目的图文教程
2022-06-15 01:09:59
![](https://img.aspxhome.com/file/2023/0/81920_0s.png)
解析C#设计模式之单例模式
2021-12-15 17:41:12