C产品在市场上有哪些独特优势?
- 内容介绍
- 文章标签
- 相关推荐
本文共计308个文字,预计阅读时间需要2分钟。
为了简化这段内容,以下是一个简化的版本:
简化后的内容:
需要实现PPT转图片功能,首先需要引用两个DLL。我这里使用的是Microsoft.Office.Interop.PowerPoint 12.0和Microsoft Office 12.0 Object Library。代码如下:
csharpprivate void pptToImg(string pptPath){ // 代码实现}
要实现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(); }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易盾网络。
本文共计308个文字,预计阅读时间需要2分钟。
为了简化这段内容,以下是一个简化的版本:
简化后的内容:
需要实现PPT转图片功能,首先需要引用两个DLL。我这里使用的是Microsoft.Office.Interop.PowerPoint 12.0和Microsoft Office 12.0 Object Library。代码如下:
csharpprivate void pptToImg(string pptPath){ // 代码实现}
要实现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(); }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易盾网络。

