TTMSFNCGridExcelExport.ExportPdf Method
Overloads
- TTMSFNCGridExcelExport.ExportPdf(TFileName)
- TTMSFNCGridExcelExport.ExportPdf(TStream)
- TTMSFNCGridExcelExport.ExportPdf(TStream, TFlexCelPdfExport)
TTMSFNCGridExcelExport.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: VCL.TMSFNCGridExcelExport / FMX.TMSFNCGridExcelExport
procedure TTMSFNCGridExcelExport.ExportPdf(const aFileName: TFileName); overload;
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
const | aFileName | TFileName | Filename of the generated file. |
See also
TTMSFNCGridExcelExport.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: VCL.TMSFNCGridExcelExport / FMX.TMSFNCGridExcelExport
procedure TTMSFNCGridExcelExport.ExportPdf(const aStream: TStream); overload;
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
const | aStream | TStream | Stream where the pdf file will be saved. |
See also
TTMSFNCGridExcelExport.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: VCL.TMSFNCGridExcelExport / FMX.TMSFNCGridExcelExport
procedure TTMSFNCGridExcelExport.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.
TMSFNCGridExcelExport1.ExportPdf(stream, pdf);
finally
pdf.Free;
end;
finally
stream.Free;
end;
end;