This project has moved. For the latest updates, please go here.

Set number of copies in printdialog

Feb 11, 2016 at 7:39 AM
Edited Feb 11, 2016 at 8:13 AM
Hi...

how is it possible to set the number of copies in the print dialog.

I used the following code to start the printdialog and set the different trays without changing the default system printer. But i didn't find a possibility to set the number of copies.
            var dialog = this.instance.Dialogs[WdWordDialog.wdDialogFilePrintSetup];

            var argValues = new object[] { printer };
            dialog.UnderlyingObject.GetType().InvokeMember("Printer", BindingFlags.SetProperty, null, dialog.UnderlyingObject, argValues);

            argValues = new object[] { 1 };
            dialog.UnderlyingObject.GetType().InvokeMember("DoNotSetAsSysDefault", BindingFlags.SetProperty, null, dialog.UnderlyingObject, argValues);

            dialog.Execute();

            try
            {
                argValues = new object[] { tray1 };
                this.currentDocument.PageSetup.UnderlyingObject.GetType().InvokeMember("FirstPageTray", BindingFlags.SetProperty, null, this.currentDocument.PageSetup.UnderlyingObject, argValues);
            }
            catch (Exception ex)
            {
                Logger.Error("TvDocumentSetPrinterData: Schacht1 konnte nicht gesetzt werden: " + ex);
            }

            try
            {
                argValues = new object[] { tray2 };
                this.currentDocument.PageSetup.UnderlyingObject.GetType().InvokeMember("OtherPagesTray", BindingFlags.SetProperty, null, this.currentDocument.PageSetup.UnderlyingObject, argValues);
            }
            catch (Exception ex)
            {
                Logger.Error("TvDocumentSetPrinterData: Schacht2 konnte nicht gesetzt werden: " + ex);
            }
Is there a way to set the number of copies?

Thanks

Oliver