none
Finding a hidden powerpoint slide in C# RRS feed

  • Question

  • Hello,

         I am trying to access the powerpoint slides from a C# form based application . I am able to get the slides , but if i want to goto a particular slide and if that slide is hidden i get an exception . So is there a way to find whether a slide is hidden or not?

        Also is there any foolproof method to find whether a particular slide is having Notes? If so how can i extract those notes ?

        Currently i use "string a = objPres.Slides[index].NotesPage.Shapes.Placeholders[2].TextFrame.TextRange.Text;" for extracting notes.

        Is the placeholder value index correct ?

    My Environment is Visual Studio C# 2010

    Microsoft office 2003.

    Any help will be highly appreciated.

     

    Regards,

    Yashath.

     

    Wednesday, May 4, 2011 6:43 AM

Answers

  • Hello Yashath,

    you can check if the slide has notes with 'HasNotesPage' property of slide:

    if(objPres.Slides[index].HasNotesPage == Microsoft.Office.Core.MsoTriState.msoTrue)

    {

    }

    You can check the next property too:

    objPres.Slides[index].Shapes.Placeholders[1].TextFrame2.HasText

    Regards,

    Iso7

    Thursday, May 5, 2011 2:26 PM

All replies

  • Hello,

    I'm sorry I don't understand what do you mean by "hidden slide".

    You can try simplify your expression to check if all the objects it returs are valid.


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    Wednesday, May 4, 2011 8:02 AM
  • Hello,

           What i meant is , if a slide is hidden in powerpoint and the slideshow is on then the slide will not be shown in the slideshow . Right ? So if i want to goto a particular slide by using slide index and unfortunatley if that slide is hidden then i get an exception .

    Hope i am sounding clear .

     

    Regards,

    Yashath.

     

    Thursday, May 5, 2011 5:12 AM
  • Hi Yasath

    Mmm, this seems to be a question for PowerPoint specialists. Most of these hang out on the "Answers" site - even for the object model questions - and there's little presence on MSDN:
    http://answers.microsoft.com/en-us/office/forum/word

    Unfortunately, I'm not able to move questions from MSDN to answers.

    FWIW the VBA folks, with the classic VB error-handling, probably just trap the error then move on. In VBA there's no performance hit like there is in the .NET Framework. If there's no other way you might have to go that route. But ask them first and mention that you'd prefer a possibility that does NOT involve handling the error because most of them won't know about this particular "limitation" :-)


    Cindy Meister, VSTO/Word MVP
    Thursday, May 5, 2011 6:55 AM
    Moderator
  • Hello Yashath,

    you can check if the slide has notes with 'HasNotesPage' property of slide:

    if(objPres.Slides[index].HasNotesPage == Microsoft.Office.Core.MsoTriState.msoTrue)

    {

    }

    You can check the next property too:

    objPres.Slides[index].Shapes.Placeholders[1].TextFrame2.HasText

    Regards,

    Iso7

    Thursday, May 5, 2011 2:26 PM