Powerpoint 2010 VSTO AddIn taskpane on multiple Windows
-
14-04-2021 - |
Вопрос
I would like have a taskpane displayed on each document-windows, I have read all MSDN articles about it, but it doesn't work.
I click on ToggleButton1 when 3 or 4 document are open, and i get 3 or 4 TaskPanes, but on same document window.
Edit :
I think i don't have correctly explain the problem, sorry.
New try : I click on ToggleButton1 on Presentation 1 window when 3 or 4 document are open, and i get 3 or 4 TaskPanes inside Prestation 1 window, windows from other presentation are empty.
What i want is a shared taskpane and synchronized visibility accross all presentations
ThisAddin.vb
Public Class ThisAddin
Public Sub Test()
For Each w As PowerPoint.DocumentWindow In Application.Windows
Me.CustomTaskPanes.Add(New UserControl1, "abc", w).Visible = True
Next
End Sub
End Class
Ribbon1.vb
Private Sub ToggleButton1_Click(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles ToggleButton1.Click
Globals.ThisAddIn.test()
End Sub
I also have tried with :
For Each w As PowerPoint.Presentation In Application.Presentations
Решение
In PowerPoint, the task panes are shared across all document windows. As you switch between presentation windows, the same task pane is used (this is why you get 3 or 4 panes when you add task panes for each window - they are shared across presentations). If you want separate task panes you need to open/close the active task panes (or separately manage task pane state per presentation) as you change the active DocumentWindow