1

当扩展名为“.ppt”时,我可以使用该Microsoft.office.interop.powerpoint.presentation.slide export方法拆分文件,但对于 pptx 文件,它不起作用。

有什么帮助吗?

4

2 回答 2

0

您可以在拆分之前将 *.pptx 文件转换为 *.ppt 文件。

一些示例代码供您参考:

using System;
using System.Collections.Generic;
using System.Text;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Microsoft.Office.Core;

namespace pptxTOppt
{
    class Program
    {
        static void Main(string[] args)
        {
            PowerPoint.Application app = new PowerPoint.Application();
            string sourcePptx = @"c:\test.pptx";
            string targetPpt = @"c:\test.ppt";
            object missing = Type.Missing;
            PowerPoint.Presentation pptx = app.Presentations.Open(sourcePptx, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoTrue);
            pptx.SaveAs(targetPpt, PowerPoint.PpSaveAsFileType.ppSaveAsPowerPoint4);
            app.Quit();
        }
    }
}

从以下链接引用: http://social.msdn.microsoft.com/Forums/office/en-US/df79729d-a2a0-4e1e-9620-02248c171e62/c-code-to-convert-pptx-to-ppt?论坛=离题

于 2014-08-01T08:06:23.763 回答
0

回复太晚了。但这可能对其他人有帮助

 foreach ( Slide slides in Pres.Slides)
   {
      slides.Export(Filename, "pptx" (or the target type), Scale-Width, Scale-Height); 
    }
于 2019-12-11T12:05:30.457 回答