Set Microsoft Office Addin for excel taskpane width by default

66 Views Asked by At

We are developing a web add-in (Microsoft Office Add-In) for excel, and are using taskpanes to show the UI, by default the taskpane width is about 20% approx of the screen size. Is there a way we can set the taskpane width to some predetermined width?

I found this KB https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/customize-default-task-pane-width-for-excel-add-ins/idi-p/3254715#:~:text=The%20default%20width%20of%20the,task%20pane%20is%20320%20pixels.

But this seems to be an open request.

Thanks in advance. Abhijit.

1

There are 1 best solutions below

0
J i N On

You can only customize taskpane width in VSTO add-ins In Office js add-in you cannot customize add-in taskpane width with code.

Using this You can open Your taskpane with your custom width in VSTO C# Add-in.

       private void ThisAddIn_Startup(object sender, System.EventArgs e)
         {
           Taskpane uc = new Taskpane();

           Microsoft.Office.Tools.CustomTaskPaneCollection customPaneCollection;
           customPaneCollection = Globals.Factory.CreateCustomTaskPaneCollection(null, null, "Panes", "Panes", this);
           Microsoft.Office.Tools.CustomTaskPane ctp = customPaneCollection.Add(uc, "My AddIn Taskpane");
           ctp.Width = 350;
           ctp.Visible = false;
         }