gpt4 book ai didi

c# - 尝试使用 C# 打开 Microsoft Powerpoint 文件时出现文件损坏错误

转载 作者:太空宇宙 更新时间:2023-11-03 15:43:56 24 4
gpt4 key购买 nike

使用C#打开ppt文件时出现文件损坏错误

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

错误是

enter image description here

最佳答案

据我在 MSDN 上看到的,PresentationDocument 来自 OpenXML SDK,是吗?如果是这样,这仅支持使用 PresentationML 格式的 OpenXML 文档。

文件上的 .ppt 扩展名(而不是 .pptx)表明它是较旧的二进制格式,不受支持。作为测试,将该文件的副本另存为 .pptx 并查看是否有效。

您在评论中提到了使用 Aspose 的成功。 Aspose Slides 确实支持旧的二进制格式,这将为我的理论提供证据。

关于c# - 尝试使用 C# 打开 Microsoft Powerpoint 文件时出现文件损坏错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29026179/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com