本文将演示如何将PowerPoint文档转换为EMF图像。 使用Spire.Presentation for .NET,我们可以将演示幻灯片保存为与原始幻灯片相同大小的EMF图像,我们还可以为所得到的EMF图像设置特定大小。
将演示幻灯片转换为EMF,默认大小:
Step 1:创建演示文稿
Presentation presentation = new Presentation();
Step 2:从磁盘加载PPTX文件
presentation.LoadFromFile("Sample.pptx", FileFormat.Pptx2010);
Step 3:通过SaveAsEMF()的方法将演示幻灯片保存到EMF图像
presentation.Slides[2].SaveAsEMF("Result.emf");
效果截图:
演示幻灯片转换为特定尺寸为1075 * 710的EMF:
Step 1:创建演示文稿
Presentation presentation = new Presentation();
Step 2:从磁盘加载PPTX文件
presentation.LoadFromFile("sample.pptx");
Step 3:通过SaveAsEMF(string filePath,int width,int height)的方法将演示文稿幻灯片保存为特定大小为1075 * 710的EMF图像
presentation.Slides[2].SaveAsEMF("Result2.emf", 1075, 710);
效果截图:
完整代码:
static void Main(string[] args) { Presentation presentation = new Presentation(); presentation.LoadFromFile("Sample.pptx", FileFormat.Pptx2010); //presentation.Slides[2].SaveAsEMF("Result.emf"); presentation.Slides[2].SaveAsEMF("Result2.emf", 1075, 710); }
点击下载Spire.Presentation for .NET