如何保存的* .ppt,* .PPTX文件,* .WMV使用互操作使用C#?操作、文件、ppt、PPTX

由网友(╰低调渲染那一抹妖娆°つ)分享简介:我想下一个code做到这一点:I tried to do this with the next code: using Microsoft.Office.Core;using PowerPoint = Microsoft.Office.Interop.PowerPoint;using System.IO;us...

我想下一个code做到这一点:

I tried to do this with the next code:

using Microsoft.Office.Core;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using System.IO;
using Microsoft.Office.Interop.PowerPoint;

namespace SavePPT
{
        class Program
        {
            static void Main(string[] args)
            {
                Application app = new PowerPoint.Application();
                var pres = app.Presentations;
                var file = pres.Open(@"C:Presentation1.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
                file.SaveCopyAs(@"C:presentation1.wmv", PowerPoint.PpSaveAsFileType.ppSaveAsWMV, MsoTriState.msoCTrue);

                app.Quit();

            }
        }
}

不过,当然这种解决方案创建的0 KB大小的文件,我不能玩。

But this solution created file with 0 KB size and of course I can't play it.

推荐答案

PowerPoint的SaveCopyAs方法似乎并不支持ppSaveAsWMV。它明确指出,它支持在 MSDN页 SaveCopyAs,其中不包括ppSaveAsWMV不变。

PowerPoint's SaveCopyAs method doesn't appear to support ppSaveAsWMV. It explicitly states which it supports on the MSDN page for SaveCopyAs, which doesn't include the ppSaveAsWMV constant.

阅读全文

相关推荐

最新文章