none
C# PowerPoint Addin doesn't work if preview pane is selected. RRS feed

  • Question

  • I have a PowerPoint addin called AutoStyleIt (will be on CodePlex soon at http://autostyleit.codeplex.com)

    AutoStyleIt takes the current slide, duplicates the slide x number of times where x = the number of bullets (paragraphs) on the page - 1.

    Then on each of the slides, the first slide highlights the first paragraph, the second slide highlights the second paragraph, etc.

    This all works, and I solved my refresh problem with a message box at the end.

    Now I have a new problem, if the user has the Preview Pane on the left side selected, I get an error "View does not support selection." when I refer to this line of code:

    // Create the RGB

    app.ActiveWindow.Selection.TextRange.Font.Color.RGB =

    CreateRGB(selectedColor);

    This works as expected if I (the user of PowerPoint) clicks the main slide area before clicking my button.

    I have tried this:

    // attempt to fix a bug in case the Thumbnail pane is selected
    app.ActivePresentation.Slides[curSlide.SlideIndex].Select();

    And I still get the error if the preview pane is active; if the main slide area is active it works as expected.

    Does anyone have any ideas how to force the Main Slide area to be the "Selected"?

    Thanks,

    Levitation is hard; showing someone else is really hard.


    Corby

    Wednesday, May 1, 2013 2:11 PM

Answers

  • I solved it with this:

     // if the preview pane is selected
     if (app.ActiveWindow.ActivePane.ViewType == Microsoft.Office.Interop.PowerPoint.PpViewType.ppViewThumbnails)
     {   
         // activate pane (Is there a constant for what the Main pane is called?
         app.ActiveWindow.Panes[2].Activate();
     }
    Look for Auto Style It on CodePlex. I should be able to release Auto Style It on CodePlex tonight (May 1, 2013).

    Corby


    Wednesday, May 1, 2013 3:37 PM

All replies

  • I solved it with this:

     // if the preview pane is selected
     if (app.ActiveWindow.ActivePane.ViewType == Microsoft.Office.Interop.PowerPoint.PpViewType.ppViewThumbnails)
     {   
         // activate pane (Is there a constant for what the Main pane is called?
         app.ActiveWindow.Panes[2].Activate();
     }
    Look for Auto Style It on CodePlex. I should be able to release Auto Style It on CodePlex tonight (May 1, 2013).

    Corby


    Wednesday, May 1, 2013 3:37 PM
  • Hi Corby,

    I'm glad to hear that your issue has been resolved.

    Thank you for sharing your solution which might be very helpful to other community members.

    Have a nice day.


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, May 2, 2013 2:50 AM
    Moderator