获取损坏的文件错误,而试图用C#打开微软Powerpoint文件 [英] Getting corrupted file error while trying to open Microsoft Powerpoint file using C#

查看:332
本文介绍了获取损坏的文件错误,而试图用C#打开微软Powerpoint文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用打开PPT文件时收到损坏的文件错误C#

i am getting corrupted file error when opening ppt file using C#

public void Slide()
    {
        string dataDir = Path.GetFullPath(@"C:\Users\Vipin\Desktop\");
        using (PresentationDocument doc = PresentationDocument.Open(dataDir + "Android.ppt", true))
        {
            // Insert other code here.
        }
    }

和误差

推荐答案

从我可以在MSDN上看到,presentationDocument从OpenXML的SDK来了,是吗?如果是这样,这仅支持使用presentationML格式Ope​​nXML文档。

From what I can see on MSDN, PresentationDocument is coming from the OpenXML SDK, yes? If so, this only supports OpenXML documents using the PresentationML format.

在你的文件中的 .PPT 扩展(而不是 .PPTX )表明它是老的二进制格式,不被支持。作为测试,该文件的副本保存为 .PPTX ,看看,如果这个工程。

The .ppt extension on your file (rather than .pptx) suggests it is the older binary format, which isn't supported. As a test, save a copy of the file as a .pptx and see if this works.

您已经在使用注释提到的Aspose成功。阅读Aspose幻灯片不支持旧的二进制格式,这将给予证明我的理论。

You've mentioned success using Aspose in a comment. Aspose Slides does support the older binary format, which would lend evidence to my theory.

这篇关于获取损坏的文件错误,而试图用C#打开微软Powerpoint文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆