Search Results for

    Show / Hide Table of Contents

    TTMSFMXGridExcelExport.ExportPdf Method

    Overloads

    • TTMSFMXGridExcelExport.ExportPdf(TFileName)
    • TTMSFMXGridExcelExport.ExportPdf(TStream)
    • TTMSFMXGridExcelExport.ExportPdf(TStream, TFlexCelPdfExport)

    TTMSFMXGridExcelExport.ExportPdf(TFileName)

    Exports the attached grid to Pdf.

    Remarks

    This method will export to pdf with the standard xls file defaults. If you want to customize the export more (for example provide an Author for the pdf file) you can use ExportPdf(TStream, TFlexCelPdfExport) instead.

    Syntax

    Unit: FMX.TMSGridExcelExport

    procedure TTMSFMXGridExcelExport.ExportPdf(const aFileName: TFileName); overload;

    Parameters

    <-> Parameter Type Description
    const aFileName TFileName Filename of the generated file.

    See also

    • TTMSFMXGridExcelExport

    TTMSFMXGridExcelExport.ExportPdf(TStream)

    Exports the attached grid to Pdf.

    Remarks

    This method will export to pdf with the standard defaults. If you want to customize the export more (for example provide an Author for the pdf file) you can use ExportPdf(TStream, TFlexCelPdfExport) instead.

    Syntax

    Unit: FMX.TMSGridExcelExport

    procedure TTMSFMXGridExcelExport.ExportPdf(const aStream: TStream); overload;

    Parameters

    <-> Parameter Type Description
    const aStream TStream Stream where the pdf file will be saved.

    See also

    • TTMSFMXGridExcelExport

    TTMSFMXGridExcelExport.ExportPdf(TStream, TFlexCelPdfExport)

    Exports the attached grid to Pdf. As this method uses a TFlexCelPdfExport class to do the export, you can customize all options in the pdf exporting before calling this method.

    Remarks

    Note that for a complete control over the Excel file and the PDF file, you should use Export(TExcelFile, TInsertInSheet) and then use your own TFlexCelPdfExport to manually create the PDF from the TExcelFile

    Syntax

    Unit: FMX.TMSGridExcelExport

    procedure TTMSFMXGridExcelExport.ExportPdf(const aStream: TStream; const aPdf: TFlexCelPdfExport); overload;

    Parameters

    <-> Parameter Type Description
    const aStream TStream Stream where the pdf file will be saved.
    const aPdf TFlexCelPdfExport This is a TFlexCelPdfExport component that you need to create.

    Examples

    To export the grid to PDF, customizing the PDF output, you can use the code:

    uses ..., FlexCel.Core, FlexCel.XlsAdapter, FlexCel.Render, FlexCel.Pdf;
    ...
    procedure TExampleForm.ExportGridToPdf;
    var
      pdf: TFlexCelPdfExport;
      stream: TFileStream;
    begin
      stream := TFileStream.Create('MyFile.pdf', fmCreate);
      try
        //FlexCelPdfExport that we will use to do the export.
        pdf := TFlexCelPdfExport.Create;
        try
          pdf.AllowOverwritingFiles := true;
          //Here we can customize the FlexCelPdfExport.
          //For example, we can set the export to be PDF/A
          pdf.PdfType := TPdfType.PDFA3;
          //Or set the pdf author
          pdf.Properties.Author := 'myself';
    
          //Export the grid to the stream, using our custom FlexCelPdfExport.
          TMSFMXGridExcelExport1.ExportPdf(stream, pdf);
        finally
          pdf.Free;
        end;
      finally
        stream.Free;
      end;
    end;
    

    See also

    • TTMSFMXGridExcelExport
    In This Article
    Back to top TMS FMX Grid Excel bridge v3.1.0
    © 2002 - 2021 tmssoftware.com