private void PageSetupDialogHidden()
{
Word.Dialog dlg = Application.Dialogs[Word.WdWordDialog.wdDialogFilePageSetup];
invokeHelper(dlg,"PageWidth","3.3\"");
invokeHelper(dlg,"PageHeight","6\"");
invokeHelper(dlg,"TopMargin","0.71\"");
invokeHelper(dlg,"BottomMargin","0.81\"");
invokeHelper(dlg,"LeftMargin","0.66\"");
invokeHelper(dlg,"RightMargin","0.66\"");
invokeHelper(dlg,"HeaderDistance","0.28\"");
invokeHelper(dlg,"Orientation","0");
invokeHelper(dlg,"DifferentFirstPage","0");
invokeHelper(dlg,"FirstPage","0");
invokeHelper(dlg,"OtherPages","0");
// Apply these settings only to the current selection with this line of code:
invokeHelper(dlg,"ApplyPropsTo","3");
// Apply the settings.
dlg.Execute();
}
private static void invokeHelper(Word.Dialog dlg, string member, string value)
{
System.Type dlgType = typeof(Word.Dialog);
// Set the appropriate property of the dialog box.
dlgType.InvokeMember(member,
System.Reflection.BindingFlags.SetProperty |
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance,
null, dlg, new object[] {value},
System.Globalization.CultureInfo.InvariantCulture);
}