Printing to File Automation
RB v 6.03 Enterprise
I have a few questions about printing to file.
Is there any way to control the default settings of the print dialog so that
the default file type, and file name can be set?
Also, is it possible to detect when a user has printed to a file so that the
file that has been printed to can automatically be opened?
I know how to open a file using shell commands.
What I would like to do is when the user click the print to file checkmark.
The file type (Excel) will already be selected and a file path and name will
already be selected so that all the user has to do is click 'OK' and they
are done. Then after the report has been printed to file it automatically
opens the file.
Bill
I have a few questions about printing to file.
Is there any way to control the default settings of the print dialog so that
the default file type, and file name can be set?
Also, is it possible to detect when a user has printed to a file so that the
file that has been printed to can automatically be opened?
I know how to open a file using shell commands.
What I would like to do is when the user click the print to file checkmark.
The file type (Excel) will already be selected and a file path and name will
already be selected so that all the user has to do is click 'OK' and they
are done. Then after the report has been printed to file it automatically
opens the file.
Bill
This discussion has been closed.
Comments
1. Unfortunately, the default file type selected in the printdialog is hard
coded to be the first item in the list. It is possible to customize any of
the forms in ReportBuilder so you could create a copy of the ppPDlg.pas file
and add your own code to make it default to another file type. You will
want to check out the SetFileDeviceType method and change the first two
lines to something similare to what I have below:
if (cbxPrintToFileTypes.Items.Count > 0 and cbxPrintToFileTypes.Items.Count
<= 3) then
cbxPrintToFileTypes.ItemIndex := 3
2. You can use the Report.AfterPrint event to see if it was printed to file
by checking if the filedevice is nil:
procedure TForm1.ppReport1AfterPrint(Sender: TObject);
begin
if (ppReport1.FileDevice <> nil) then
ShowMessage('Report was printed to file');
end;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
both of these things. The demo is at www.waler.com/download.htm
James Waler
Waler Ltd
http://www.waler.com