简体   繁体   English

使用 openxml C# 生成的损坏的 powerpoint pptx

[英]Corrupted powerpoint pptx generated using openxml C#

I am getting the following error while opening the powerpoint file, generated using open xml.打开使用 open xml 生成的 powerpoint 文件时出现以下错误。 I compared the xml of repaired file and corrupted file, it seems to be the same.我比较了修复文件和损坏文件的xml,似乎是一样的。 Can you please help你能帮忙吗

Thanks in advance.提前致谢。

Edit:编辑:

I used the sample code from here .我使用了 这里的示例代码。 If you run this code, it works fine.如果您运行此代码,它可以正常工作。 However, if we change this part:但是,如果我们更改这部分:

   bodyShape.TextBody = new TextBody(new Drawing.BodyProperties(),
                        new Drawing.ListStyle(),
                        new Drawing.Paragraph(new Drawing.Run(new Drawing.Text() { Text = text }));

It creates the corrupt file.它会创建损坏的文件。

打开pptx时出错

                string _DescripcionSuperior = "Hello World";

                bodyShape.TextBody = new P.TextBody(new Drawing.BodyProperties(),
                             new Drawing.ListStyle(),
                             new Drawing.Paragraph(new Drawing.Run(
                                 new Drawing.RunProperties() { Language = "es-MX", FontSize = 1000, Dirty = false, Bold = false },
                                 new Drawing.Text(_DescripcionSuperior)
                                 )));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM