Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

New Post: Set number copies in printdialog

$
0
0
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

Viewing all articles
Browse latest Browse all 1741

Trending Articles