menu

Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class DataGridPdfExportingController - Xamarin.Forms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class DataGridPdfExportingController

    A Class which defines various options to export the SfDataGrid to a PDF. Provides classes, methods, properties and events to export and customize the exported values of a SfDataGrid.

    Inheritance
    System.Object
    DataGridPdfExportingController
    Namespace: Syncfusion.SfDataGrid.XForms.Exporting
    Assembly: Syncfusion.SfGridConverter.XForms.dll
    Syntax
    public class DataGridPdfExportingController : Object

    Constructors

    DataGridPdfExportingController()

    Initializes a new instance of the DataGridPdfExportingController class.

    Declaration
    public DataGridPdfExportingController()

    Properties

    PdfGrid

    Gets or private sets the exporing PdfGrid

    Declaration
    protected PdfGrid PdfGrid { get; }
    Property Value
    Type
    PdfGrid

    Methods

    add_CellExporting(DataGridCellPdfExportingEventHandler)

    Declaration
    public void add_CellExporting(DataGridCellPdfExportingEventHandler value)
    Parameters
    Type Name Description
    DataGridCellPdfExportingEventHandler value

    add_HeaderAndFooterExporting(PdfHeaderFooterEventHandler)

    Declaration
    public void add_HeaderAndFooterExporting(PdfHeaderFooterEventHandler value)
    Parameters
    Type Name Description
    PdfHeaderFooterEventHandler value

    add_RowExporting(DataGridRowPdfExportingEventHandler)

    Declaration
    public void add_RowExporting(DataGridRowPdfExportingEventHandler value)
    Parameters
    Type Name Description
    DataGridRowPdfExportingEventHandler value

    ExportCellValue(SfDataGrid, RecordEntry, GridColumn, PdfGridCell, DataGridPdfExportOption, Object)

    Exports cellvalue to the pdf document, cellvalue are obtained from the record using gridcolumn mappping name. when exporting each cell cellexporting event handler is called. For image column, image is converted as stream and then image will export. For switch column, check box will export. When overridden in a derived class, is invoked whenever application code or internal processes call ExportCellValue

    Declaration
    protected virtual void ExportCellValue(SfDataGrid dataGrid, RecordEntry record, GridColumn column, PdfGridCell pdfCell, DataGridPdfExportOption exportOption, object pagedRecord = null)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    SfDataGrid instance

    RecordEntry record

    RecordEntry value

    GridColumn column

    GridColumn value

    PdfGridCell pdfCell

    IRange instance

    DataGridPdfExportOption exportOption

    Grid Excel ExportingOptions

    System.Object pagedRecord

    object value

    ExportRecordToPdf(SfDataGrid, RecordEntry, PdfGridRow, DataGridPdfExportOption, Group, Object)

    Exports record to pdf. RowExporting Event handler handled here When overridden in a derived class, is invoked whenever application code or internal processes call ExportRecordToPdf

    Declaration
    protected virtual void ExportRecordToPdf(SfDataGrid dataGrid, RecordEntry record, PdfGridRow pdfRow, DataGridPdfExportOption exportOption, Group group, object pagedRecord = null)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    SfDataGrid instance

    RecordEntry record

    Record Entry

    PdfGridRow pdfRow

    Pdf Grid Row

    DataGridPdfExportOption exportOption

    Grid Pdf ExportOption

    Group group

    group value

    System.Object pagedRecord

    object for Pdf Grid

    ExportSummaryCellToPdf(SfDataGrid, PdfGridCell, ExportCellType, String, String)

    Export the summary cell to PDF.

    Declaration
    protected virtual void ExportSummaryCellToPdf(SfDataGrid dataGrid, PdfGridCell pdfGridCell, ExportCellType exportCellType, string summaryDisplayText, string columnName)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    Specifies the SfDataGrid.

    PdfGridCell pdfGridCell

    Specifies the PdfGridCell.

    ExportCellType exportCellType

    Specifies the export cell type.

    System.String summaryDisplayText

    Specifies summary display text.

    System.String columnName

    Specifies the column name.

    ExportTableSummariesToPdf(SfDataGrid, PdfGrid, ICollectionViewAdv, DataGridPdfExportOption)

    Export the table summary rows to PDF.

    Declaration
    protected virtual void ExportTableSummariesToPdf(SfDataGrid dataGrid, PdfGrid pdfGrid, ICollectionViewAdv view, DataGridPdfExportOption exportOption)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    Specifies the SfDataGrid.

    PdfGrid pdfGrid

    Specifies the PdfGrid

    ICollectionViewAdv view

    Specifies the SfDataGridView.

    DataGridPdfExportOption exportOption

    Specifies the instance of class DataGridPdfExportOption which is used to set the exporting options.

    ExportTableSummaryRecordToPdf(SfDataGrid, PdfGrid, ICollectionViewAdv, DataGridPdfExportOption, ExportCellType, PdfGridCellStyle, SummaryRecordEntry)

    Export the table summary row to PDF.

    Declaration
    protected virtual void ExportTableSummaryRecordToPdf(SfDataGrid dataGrid, PdfGrid pdfGrid, ICollectionViewAdv view, DataGridPdfExportOption exportOption, ExportCellType cellType, PdfGridCellStyle cellStyle, SummaryRecordEntry summaryRecordEntry)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    Specifies the SfDataGrid.

    PdfGrid pdfGrid

    Specifies the PdfGrid

    ICollectionViewAdv view

    Specifies the SfDataGridView.

    DataGridPdfExportOption exportOption

    Specifies the instance of class DataGridPdfExportOption which is used to set the exporting options.

    ExportCellType cellType

    Specifies the PDF Grid Cell type.

    PdfGridCellStyle cellStyle

    Specifies the style.

    SummaryRecordEntry summaryRecordEntry

    Specifies the SumamryRecordEntry.

    ExportToPdf(SfDataGrid)

    Exports the data in the grid to pdf document based on the default export option and returns PdfDocument.

    Declaration
    public PdfDocument ExportToPdf(SfDataGrid dataGrid)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The reference of the SfDataGrid.

    Returns
    Type Description
    PdfDocument

    The PdfDocument containing the exported data in the grid.

    ExportToPdf(SfDataGrid, ICollectionViewAdv, DataGridPdfExportOption)

    Exports grid to the pdf document based on the given export option and returns PdfDocument.

    Declaration
    public PdfDocument ExportToPdf(SfDataGrid dataGrid, ICollectionViewAdv collectionView, DataGridPdfExportOption exportOption)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The reference of the SfDataGrid.

    ICollectionViewAdv collectionView

    The underlying collection of the datagrid.

    DataGridPdfExportOption exportOption

    The DataGridPdfExportOption containing the additional options for customizing the data in the grid when exporting to pdf.

    Returns
    Type Description
    PdfDocument

    The PdfDocument containing the exported data in the grid.

    ExportToPdf(SfDataGrid, DataGridPdfExportOption)

    Exports the data in the grid to pdf document based on given export option and returns PdfDocument.

    Declaration
    public PdfDocument ExportToPdf(SfDataGrid dataGrid, DataGridPdfExportOption exportOption)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The reference of the SfDataGrid.

    DataGridPdfExportOption exportOption

    The DataGridPdfExportOption containing the additional options for customizing the data in the grid when exporting to pdf.

    Returns
    Type Description
    PdfDocument

    The PdfDocument containing the exported data in the grid.

    ExportToPdf(SfDataGrid, ObservableCollection<Object>, DataGridPdfExportOption)

    Exports the selected row in the grid to pdf document based on either given export option or default export option and returns PdfDocument.

    Declaration
    public PdfDocument ExportToPdf(SfDataGrid dataGrid, ObservableCollection<object> selectedItems, DataGridPdfExportOption pdfExportOption = null)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The reference of the SfDataGrid.

    System.Collections.ObjectModel.ObservableCollection<System.Object> selectedItems

    The SelectedItems collection in SfDataGrid.

    DataGridPdfExportOption pdfExportOption

    The DataGridPdfExportOption containing the additional options for customizing the data in the grid when exporting to pdf.

    Returns
    Type Description
    PdfDocument

    The PdfDocument containing the exported selected row in the grid.

    ExportToPdfGrid(SfDataGrid, ICollectionViewAdv, DataGridPdfExportOption, PdfDocument)

    Creates PdfGrid equivalent to the SfDataGrid.

    Declaration
    public PdfGrid ExportToPdfGrid(SfDataGrid dataGrid, ICollectionViewAdv collectionView, DataGridPdfExportOption exportOption, PdfDocument pdfDocument)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The reference of the SfDataGrid.

    ICollectionViewAdv collectionView

    The underlying collection of the datagrid.

    DataGridPdfExportOption exportOption

    The DataGridPdfExportOption containing the additional options for customizing the data in the grid when exporting to pdf.

    PdfDocument pdfDocument

    The PdfDocument containing the exported data in the grid.

    Returns
    Type Description
    PdfGrid

    The PdfGrid which is equivalent to the SfDataGrid.

    ExportUnboundRowCellToPdf(SfDataGrid, PdfGridCell, DataGridPdfExportOption, GridUnboundRow, GridColumn)

    Declaration
    protected virtual void ExportUnboundRowCellToPdf(SfDataGrid grid, PdfGridCell pdfGridCell, DataGridPdfExportOption excelExportingOptions, GridUnboundRow gridUnboundRow, GridColumn gridColumn)
    Parameters
    Type Name Description
    SfDataGrid grid
    PdfGridCell pdfGridCell
    DataGridPdfExportOption excelExportingOptions
    GridUnboundRow gridUnboundRow
    GridColumn gridColumn

    ExportUnboundRowsToPdf(SfDataGrid, PdfGrid, DataGridPdfExportOption, UnboundRowsPosition, Boolean, ObservableCollection<GridUnboundRow>)

    Declaration
    protected virtual void ExportUnboundRowsToPdf(SfDataGrid dataGrid, PdfGrid pdfGrid, DataGridPdfExportOption exportOption, UnboundRowsPosition position, bool belowSummary, ObservableCollection<GridUnboundRow> unBoundRows = null)
    Parameters
    Type Name Description
    SfDataGrid dataGrid
    PdfGrid pdfGrid
    DataGridPdfExportOption exportOption
    UnboundRowsPosition position
    System.Boolean belowSummary
    System.Collections.ObjectModel.ObservableCollection<GridUnboundRow> unBoundRows

    ExportUnboundRowToPdf(SfDataGrid, PdfGridRow, DataGridPdfExportOption, GridUnboundRow, ExportCellType, PdfGridCellStyle)

    Declaration
    protected virtual void ExportUnboundRowToPdf(SfDataGrid dataGrid, PdfGridRow pdfRow, DataGridPdfExportOption exportOption, GridUnboundRow gridUnboundRow, ExportCellType cellType, PdfGridCellStyle cellStyle)
    Parameters
    Type Name Description
    SfDataGrid dataGrid
    PdfGridRow pdfRow
    DataGridPdfExportOption exportOption
    GridUnboundRow gridUnboundRow
    ExportCellType cellType
    PdfGridCellStyle cellStyle

    remove_CellExporting(DataGridCellPdfExportingEventHandler)

    Declaration
    public void remove_CellExporting(DataGridCellPdfExportingEventHandler value)
    Parameters
    Type Name Description
    DataGridCellPdfExportingEventHandler value

    remove_HeaderAndFooterExporting(PdfHeaderFooterEventHandler)

    Declaration
    public void remove_HeaderAndFooterExporting(PdfHeaderFooterEventHandler value)
    Parameters
    Type Name Description
    PdfHeaderFooterEventHandler value

    remove_RowExporting(DataGridRowPdfExportingEventHandler)

    Declaration
    public void remove_RowExporting(DataGridRowPdfExportingEventHandler value)
    Parameters
    Type Name Description
    DataGridRowPdfExportingEventHandler value

    Events

    CellExporting

    Occurs when the cell is being exported to pdf.

    Declaration
    public event DataGridCellPdfExportingEventHandler CellExporting
    Event Type
    Type
    DataGridCellPdfExportingEventHandler
    Remarks

    This event is raised while exporting a cell at the execution time before the cell is exported.

    Examples
    DataGridPdfExportingController pdfExport = new DataGridPdfExportingController();
    pdfExport.CellExporting += pdfExport_CellExporting;  
    
    private void pdfExport_CellExporting(object sender, DataGridCellPdfExportingEventArgs e)
    {
    //You can achieve your requirement here.
    }
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/exporting#cellexporting-1

    HeaderAndFooterExporting

    Occurs when header and footer is being exported to the pdf.

    Declaration
    public event PdfHeaderFooterEventHandler HeaderAndFooterExporting
    Event Type
    Type
    PdfHeaderFooterEventHandler
    Remarks

    This event allows the user to customize the header and footer of the exported PDF.

    Examples
    DataGridPdfExportingController pdfExport = new DataGridPdfExportingController();
    pdfExport.HeaderAndFooterExporting += pdfExport_HeaderAndFooterExporting;
    
    private void pdfExport_HeaderAndFooterExporting(object sender, PdfHeaderFooterEventArgs e)
    {
    //You can achieve your requirement here.
    }
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/exporting#headerandfooterexporting

    RowExporting

    Occurs when the row is being exported to pdf.

    Declaration
    public event DataGridRowPdfExportingEventHandler RowExporting
    Event Type
    Type
    DataGridRowPdfExportingEventHandler
    Remarks

    This event is raised while exporting a row at the execution time before the row is exported.

    Examples
    DataGridPdfExportingController pdfExport = new DataGridPdfExportingController();
    pdfExport.RowExporting += pdfExport_RowExporting; 
    
    private void pdfExport_RowExporting(object sender, DataGridRowPdfExportingEventArgs e)
    {
    //You can achieve your requirement here.
    }
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/exporting#rowexporting-1
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved