CustomTask panes in word add-in. RRS feed

  • Question

  • Hi,

    I am loading two custom task panes one with treeview control and the other one with property grid.The first one docked on right and the other panes needs to place bottom right corner with a specified width.Below is the code .


                  _myUserControl = new TaskPane();
                 _myPropertyGridWindowUserCtrl = new PropertyGridWindow();

               //  _taskPaneValue = this.CustomTaskPanes.Add(_myUserControl, "Book Marks");
                 TaskPane = Globals.ThisAddIn.CustomTaskPanes.Add(_myUserControl, "BookMarks List");
                 TaskPane1 = Globals.ThisAddIn.CustomTaskPanes.Add(_myPropertyGridWindowUserCtrl, "Property");
                 TaskPane.DockPosition =
                 TaskPane.Width = 350;

                TaskPane1.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionBottom;
                TaskPane1.Height = 200;
                TaskPane1.Width = 200;
                TaskPane1.Visible = true;


    for the second pane if i set dock position is Office.MsoCTPDockPosition.msoCTPDockPositionBottom not able to set width.

    it was docked in the bottom but with full screen.I need to set same as defalut property window settings.Could you tell how to set custom pane(contains property grid as a user control) on the right bottom corner with a specified width.

    Thursday, July 24, 2014 10:56 AM


  • Hello,

    You can't set the Width property for the bottom layout. The CustomTaskPane.Width page in MSDN states the following:

    Do not use the Width property if the custom task pane is docked to the top or the bottom of the document window. If the DockPosition property is Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionTop or Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionBottom, the Width property returns 0 and throws a COMException if you try to set it.

    The maximum width depends on the dock position. When the custom task pane is docked to the left or right of the document window, the maximum width is approximately half the width of the screen. When the custom task pane is floating, there is no maximum width.

    The minimum width depends on several factors, and can change in future releases of Microsoft Office. If you try to set the Width property to a value that is less than the minimum width, the application will automatically reassign the Width property to the minimum width.

    Thursday, July 24, 2014 3:42 PM