boblawblah has asked for the wisdom of the Perl Monks concerning the following question:
Now the issue is, as that printing like this, I can't select the printer to print to and advanced options like double sided printing, resolution, layout type, etc.my $rpt = GTIMs::Report->new('Schedule::Daily', $args); $rpt->create; # populate the workbook with data $rpt->print; # print the workbook $rpt->destroy; # destroy the workbook ######################## # the report print function simply looks like this sub print { my ($self, $copies) = @_; $copies = 1 unless $copies; $self->{WorkBook}->PrintOut(Copies => 1); }
After some searching (I hope the below examples help others in a similar situation) I was able come up with the following code to display the print dialog.with ($Sheet->PageSetup, LeftHeader => '', CenterHeader => '&"Arial,Bold"&16' . $self->{Schedule}{$schedu +le}{Title} . chr(10) . "&12 $day $self->{Period}{Start}" . chr(10) . "$start - $end", RightHeader => '', LeftFooter => 'Printed &D &T', CenterFooter => '', RightFooter => 'Page &P of &N', LeftMargin => $Sheet->Application->InchesToPoints(0.15), RightMargin => $Sheet->Application->InchesToPoints(0.15), TopMargin => $Sheet->Application->InchesToPoints(1.0), BottomMargin => $Sheet->Application->InchesToPoints(0.5), HeaderMargin => $Sheet->Application->InchesToPoints(0.25), FooterMargin => $Sheet->Application->InchesToPoints(0.25), PrintHeadings => 0, PrintGridlines => 0, PrintComments => xlPrintNoComments, PrintQuality => 600, CenterHorizontally => 1, CenterVertically => 0, Orientation => xlPortrait, Draft => 0, PaperSize => xlPaperLetter, FirstPageNumber => xlAutomatic, Order => xlDownThenOver, BlackAndWhite => 0, Zoom => Variant(VT_BOOL, 0), FitToPagesWide => 1, FitToPagesTall => 1, PrintErrors => xlPrintErrorsDisplayed, PrintTitleRows => '$1:$2', PrintTitleColumns => '$A:$D', );
This displays the print dialog, and you can change these settings. Exactly what I want to do. The problem is that it is going to display the print dialog for EVERY report the user wants to print. Which could be potentially be a pretty large number. I want to display the dialog once, and then use the same print settings for each document that I am printing. Does anyone have any insight into this?use constant xlDialogPrint => 8; sub print { my $self = shift; my $dlg = $self->{Excel}->Dialogs(xlDialogPrint); my $response = $dlg->Show; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WIN32, OLE, Excel, and Printing
by Corion (Patriarch) on Aug 20, 2008 at 18:58 UTC | |
by boblawblah (Scribe) on Aug 20, 2008 at 20:14 UTC | |
by Corion (Patriarch) on Aug 21, 2008 at 06:07 UTC | |
|
Re: WIN32, OLE, Excel, and Printing
by psini (Deacon) on Aug 20, 2008 at 21:25 UTC | |
|
Re: WIN32, OLE, Excel, and Printing
by ggvaidya (Pilgrim) on Aug 21, 2008 at 04:11 UTC | |
|
Re: WIN32, OLE, Excel, and Printing
by Cefu (Beadle) on Aug 21, 2008 at 14:02 UTC | |
|
Re: WIN32, OLE, Excel, and Printing
by rpnoble419 (Pilgrim) on Aug 22, 2008 at 03:54 UTC | |
|
Re: WIN32, OLE, Excel, and Printing
by jrsimmon (Hermit) on Aug 21, 2008 at 15:54 UTC |