简体   繁体   中英

Open Powerpoint Presentation from Window Form

I am working on Office PowerPoint 2007 using c#.

I want to open the power point document. I have attached code snippet.

I also added the reference to Microsoft.Office.Interop.PowerPoint.dll

  Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
        ppApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
        Microsoft.Office.Interop.PowerPoint.Presentations oPresSet = ppApp.Presentations;
        Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(@"D:\Office Guru Support Files\temp.pptx", Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse,
        Microsoft.Office.Core.MsoTriState.msoTrue);

But I got error message like this

The type 'Microsoft.Office.Core.MsoTriState' is defined in an assembly that is not referenced. You must add a reference to assembly 'office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.

You have to add another reference to your project. Its name is simply: "Office". You can find it in the .NET references tab.

尝试用'//'代替'/'

Open(@"D:\\Office Guru Support Files\\temp.pptx",...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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