当前位置:   article > 正文

PPT组件Spire.Presentation教程:在C#中将PPT文档转换为EMF图像

c# spire.presentation

本文将演示如何将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");

效果截图:

图片1

演示幻灯片转换为特定尺寸为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

慧都控件网

转载于:https://my.oschina.net/u/3006003/blog/1529835

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/728403
推荐阅读
相关标签
  

闽ICP备14008679号