Saturday, February 25, 2006

Word Action Pane with VSTO in C# 2005

I have created a Word Action pane with a tab control contained within the user control. In order to force the user control to strech to fill the action pane space you need the following code:

private QuoteBuilder qb_actionpane = new QuoteBuilder ();

private void ThisDocument_Startup (object sender, System.EventArgs e)

{

qb_actionpane.Dock = DockStyle.Fill;

this.ActionsPane.StackOrder = Microsoft.Office.Tools.StackStyle.None;

this.ActionsPane.Controls.Add (qb_actionpane);

}


The problem is that VS2005 does not display the .Dock property so you have to set it yourself in code. In addition you need the following code

this.ActionsPane.StackOrder = Microsoft.Office.Tools.StackStyle.None;

Without this the user control does not fill the available space.

No comments: