QuickReport Save PDF by Padrao

0

My reports always have the TQRPDFfilter component, so they can be exported to PDF. However, the customer is complaining that when he clicks save, he still has to select the format he wants to save (in this case, pdf), because he always comes as QRP. I would like to know if there is a way in quickReport to set the default option, or better yet remove the save option in QRP. Does anyone know?

    
asked by anonymous 11.02.2016 / 13:49

2 answers

1

I used this code in quickreport 3.0 and delphi 7, I believe it is still working in the most current versions.

   procedure ReportExport(aReport: TQuickRep; const aFileName: TFileName);
    var Pdf: TPdfDocument;
         aMeta: TMetaFile;
         i: integer;
    begin
      Pdf := TPdfDocument.Create;
      try
        aReport.Prepare;
        for i := 1 to aReport.QRPrinter.PageCount do begin
          aMeta := aReport.QRPrinter.GetPage(i);
          try
            Pdf.DefaultPageWidth := MulDiv(aMeta.Width,72,Pdf.ScreenLogPixels);
            Pdf.DefaultPageHeight := MulDiv(aMeta.Height,72,Pdf.ScreenLogPixels);
            Pdf.AddPage;
            // desenha a pagina
            Pdf.Canvas.RenderMetaFile(aMeta,1,0,0);
          finally
            aMeta.Free;
          end;
        end;
        Pdf.SaveToFile(aFileName);
      finally
        Pdf.free;
      end;

So it will export in direct pdf.

    
11.02.2016 / 14:00
0

Raising the topic for future questions: Change the PreviewDefaultSaveType property of your quickreport to stPDF .

    
21.02.2017 / 23:51