PPT转化成Image、PPTX、XPS、EMF

最近工作经常用到演示文稿,接触到了一款不错的免费软件—Free Spire.Presentation。使用之后发现这款软件非常轻巧,功能还挺齐全。这款软件的转化功能也是非常不错的,平时遇到的各种转换难题,用短短几行代码就能搞定。现在我跟大家分享一下我的使用心得。

有兴趣的朋友可以从E-iceblue官网下载Free Spire.Presentation使用。下载完成后,请将bin文件夹的.DLL添加作为Visual Studio的引用。

 

将PPT文件转化成Image文件

1
2
3
4
5
6
7
8
9
10
11
//Create a presentation document.
Presentation presentation = new Presentation();
//Load the PPT file from disk.
presentation.LoadFromFile("sample.pptx");
// Save the slide to Image.
Image image = presentation.Slides[i].SaveAsImage();
//Save image to file.
String fileName = String.Format("result-img-{0}.png", i);
image.Save(“ToImage”, System.Drawing.Imaging.ImageFormat.Png);
//Launch and view the image.
System.Diagnostics.Process.Start(“ToImage”);

 

将PPT文件转化成PPTX文件

1
2
3
4
5
6
7
8
//Create a presentation document.
Presentation presentation = new Presentation();
//Load the PPT file from disk.
presentation.LoadFromFile("sample.ppt");
//Save the PPT document to PPTX file format.
presentation.SaveToFile("ToPPTX.pptx", FileFormat.Pptx2010);
//Launch and view the resulted PPTX file.
System.Diagnostics.Process.Start("ToPPTX.pptx");

 

将PPT文件转化成XPS文件

1
2
//Save to the XPS file.
ppt.SaveToFile("sample.xps", FileFormat.XPS);

 

将PPS文件转化成PPTX文件

1
2
//Save the PPS document to PPTX file format.
presentation.SaveToFile("ToPPTX.pptx", FileFormat.Pptx2010);

 

将PPT文件转化成EMF文件

1
2
//Save the presentation slide to EMF image.
presentation.Slides[2].SaveAsEMF("result.emf");

 

 

PS:我们在之前的文章里面曾经谈过将PPT文件转化成PDF文件,在这里就不多作介绍了。

 

posted @   E-iceblue  阅读(2493)  评论(0编辑  收藏  举报
编辑推荐:
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· 上周热点回顾(2.17-2.23)
· 如何使用 Uni-app 实现视频聊天(源码,支持安卓、iOS)
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
点击右上角即可分享
微信分享提示