Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Output to PDF

edited May 2010 in General
RB12, D7

Strange problem probably in something I am doing. I have designed a Report
Output window that prompts for the output format (pdf, xls, rft, etc) and
then runs the code below. I share the form in several applications. In
some applications it works fine with all formats. In a couple applications,
only on pdf format, it does not generate the file but rather throws up
another preview of the report. It is strange to me because if I select xls
or any other format it works correctly. They all share the same code and
form below but the actual ppReport is on a different form though I have
copied and paste thinking it might be a property in report component. Also,
it is not a file name issue because they all write to same folder (My
Documents).

Does anything come to mind that I might check?

if listFormat.ItemIndex<>10 then
begin
case listFormat.ItemIndex of
0: frmRBuilder.ppReport1.DeviceType :=dtPDF;
1: frmRBuilder.ppReport1.DeviceType :=dtXLSReport;
2: frmRBuilder.ppReport1.DeviceType :=dtXLSData;
3: frmRBuilder.ppReport1.DeviceType :=dtDOC;
4: frmRBuilder.ppReport1.DeviceType :=dtRTF;
5: frmRBuilder.ppReport1.DeviceType :=dtReportTextFile;
6: frmRBuilder.ppReport1.DeviceType :=dtJPEG;
7: frmRBuilder.ppReport1.DeviceType :='GIF';
8: frmRBuilder.ppReport1.DeviceType :=dtBMP;
9: frmRBuilder.ppReport1.DeviceType :=dtMetafile;
end;
frmRBuilder.ppReport1.AllowPrintToFile :=True;
frmRBuilder.ppReport1.ShowPrintDialog :=False;
frmRBuilder.ppReport1.TextFileName :=editFileName.Text;
frmRBuilder.ppReport1.ShowAutoSearchDialog :=False;
frmRBuilder.ppReport1.Print;
end

Comments

  • edited May 2010
    > In a couple applications, only on pdf format, it does not generate the

    Are you sure you have ppPDFDevice in the uses clause for the application?

    You can iteralte through all of the devices with the following code--check
    that each type you want is included:

    uses ppDevice;

    ppGetDeviceClasses(lStrs);
    ShowMessage(lStrs.Text);


    Ed Dressel
    Team DM
  • edited May 2010
    I found the problem. I had the following line of code in the program, left
    over from using a previous output component. That will sure cause the
    problem.

    ppUnRegisterDevice(TppPDFDevice);

    Thanks,
    Bob

This discussion has been closed.