2
votes

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'.

2

2 Answers

2
votes

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

-1
votes

try putting '//' instead of '/'

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