プレゼンテーション (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 ファイルで正常に機能します。しかし、一部のファイルでこのエラーがスローされています。私は解決策を見つけることができません。ご協力いただきありがとうございます。