本文將演示如何將PowerPoint文檔轉換爲EMF圖像。 使用Spire.Presentation for .NET,咱們能夠將演示幻燈片保存爲與原始幻燈片相同大小的EMF圖像,咱們還能夠爲所獲得的EMF圖像設置特定大小。html
將演示幻燈片轉換爲EMF,默認大小:ide
Step 1:建立演示文稿orm
Presentation presentation = new Presentation();
Step 2:從磁盤加載PPTX文件htm
presentation.LoadFromFile("Sample.pptx", FileFormat.Pptx2010);
Step 3:經過SaveAsEMF()的方法將演示幻燈片保存到EMF圖像blog
presentation.Slides[2].SaveAsEMF("Result.emf");
效果截圖:圖片
演示幻燈片轉換爲特定尺寸爲1075 * 710的EMF:文檔
Step 1:建立演示文稿get
Presentation presentation = new Presentation();
Step 2:從磁盤加載PPTX文件string
presentation.LoadFromFile("sample.pptx");
Step 3:經過SaveAsEMF(string filePath,int width,int height)的方法將演示文稿幻燈片保存爲特定大小爲1075 * 710的EMF圖像io
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); }