4

プレゼンテーション (PPTX ファイル)作成コードを使用して開くときにエラーが発生します。私が使用しているコードは以下のとおりです。

  public static void UpdatePPT()
    {
        const string presentationmlNamespace = "http://schemas.openxmlformats.org/presentationml/2006/main";
        const string drawingmlNamespace = "http://schemas.openxmlformats.org/drawingml/2006/main";

        string fileName = Server.MapPath("~/PPT1.pptx");  //path of pptx file


        using (PresentationDocument pptPackage = PresentationDocument.Open(fileName, true))
        {


        } // Using pptPackage
}

私が得ているエラーは次のとおりです。

"The document cannot be opened because there is an invalid part with an unexpected content type. 
[Part Uri=/ppt/printerSettings/printerSettings1.bin], 
[Content Type=application/vnd.openxmlformats-officedocument.presentationml.printerSettings], 
[Expected Content Type=application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings]."

でエラーが発生using (PresentationDocument pptPackage = PresentationDocument.Open(fileName, true))

コードは多くの PPTX ファイルで正常に機能します。しかし、一部のファイルでこのエラーがスローされています。私は解決策を見つけることができません。ご協力いただきありがとうございます。

4

2 に答える 2

0

最後に私は私の問題を解決しました。私が入手した PPTX は mac os で開発されたものです。だから私がしたことは私だけopened a working pptx fileです。そして、すべてをコピーして、contents of not working pptx into working pptx動作しない pptx という名前で保存しました。

于 2013-10-07T08:53:54.860 に答える