Exporting Reports with QuickReport ================================== The advice here is applicable to all profesional versions later that QR3.62, unless otherwise indicated. Available formats ----------------- these export text, images and graphics. TQRPDFDocumentFilter -> HTML ( unit QRPDFFilt.pas) TQRHTMLDocumentFilter -> HTML ( unit QRWebFilt.pas) TQRXMLSDocumentFilter -> XML ( unit QRXMLSFilt.pas) Other (text only) filters in unit QRExport.pas. TQRWMFExportFilter -> Windows metafile TQRCommaSeparatedFilter -> CSV TQRXLSFilter -> XL TQRRTFExportFilter -> richtext TQRAsciiExportFilter -> Using the export components --------------------------- Exporting may be performed from the standard preview using the 'Save' button. If an export component is placed on the report form, the corresponding option will be added to the save file dialog. This defaults to 'QRP' except in QR5 where the default export fromat may be set using the 'PreviewDefaultSaveType' option of the report. Exporting from code ------------------- The principle is the same for all the document filters. [Note that the document filter is not the corresponding component on the tool palette. These are not used for exports in code.] uses ; var aExpFilt : ; begin aExpFilt := .Create(); // Set any relevant properties aExpFilt. := ; // perform the export repForm.Quickrep1.ExportToFilter( aExpFilt ); // clean up aExpFilt.Free; end; Examples -------- 1. PDF to file uses QRPDFFilt; var aPDF : TQRPDFDocumentFilter; begin aPDF := TQRPDFDocumentFilter.Create('report.pdf'); aPDF.FontHandling := fhAutoEmbed; repform.QuickRep1.ExportToFilter( aPDF); aPDF.Free; end; 2. PDF to Stream var aPDF : TQRPDFDocumentFilter; tmplist : TStringlist; begin tmplist := TStringlist.Create; // omitting the file name means the report is streamed aPDF := TQRPDFDocumentFilter.Create(''); aPDF.FontHandling := fhAutoEmbed; repform.QuickRep1.ExportToFilter( aPDF); // catch the PDF stream in a list apdf.Stream.Position := 0; tmplist.LoadFromStream(aPDF.Stream); tmplist.SaveToFile('pdf from stream.pdf'); aPDF.Free; tmplist.free; end; The same code may in princple be used with any filter except WMF. 3. WMF ( Windows metafile). The WMF export filter works differently than the other filters. The other export filters render the report using the filter. The WMF filter takes the pages rendered to the preview and saves each page as a metafile. To use this filter outside of the preview, you have to render the report first using Prepare. var aWMFFilt : QRWMFExportFilter; begin TQRWMFExportFilter.Create('c:reports') quickrep1.Prepare; quickrep1.qrprinter.ExportToFilter(aWMFFilt); quickrep1.qrprinter.Free; quickrep1.qrprinter := nil; Please note that the file name extension is picked by the Enhanced property to the export filter. EMF if it's True, WMF if it's false. (c) QBS Software 2008