Exporting

9 Mar 20189 minutes to read

The pivot grid control can be exported to the following file formats:

  • Microsoft Excel
  • Microsoft Word
  • PDF
  • CSV

The pivot grid control can be exported by invoking the “exportPivotGrid” method with an appropriate export option as a parameter.

JSON export

<div class="e-control">
	
	{{ej-pivotgrid id="PivotGrid" e-dataSource=model.dataSource}}
    {{ej-button id="Export" e-text="Export" e-click=model.Export }}
	
	</div>
import Ember from 'ember';

export default Ember.Route.extend({
   model(){
    return {
                //...
                
                Export: function(args) {
                    var pGridObj = $('.e-pivotgrid').data("ejPivotGrid");
                    pGridObj.exportPivotGrid("http://js.syncfusion.com/ejservices/api/PivotGrid/Olap/ExcelExport", "fileName");
                }
        }
    }
});

Excel export

You can export the contents of pivot grid to an Excel document for future archival, references, and analysis purposes.

To achieve Excel export, the service URL and the file name are set as parameters.

  • JS
  • import Ember from 'ember';
    
    export default Ember.Route.extend({
       model(){
        return {
                    //...
                    
                    Export: function(args) {
                        var pGridObj = $('.e-pivotgrid').data("ejPivotGrid");
                        pGridObj.exportPivotGrid("http://js.syncfusion.com/ejservices/api/PivotGrid/Olap/ExcelExport", "fileName");
                    }
            }
        }
    });

    Word export

    You can export the contents of pivot grid to a Word document for future archival, references, and analysis purposes.

    To achieve Word export, the service URL and the file name are set as parameters.

  • JS
  • import Ember from 'ember';
    
    export default Ember.Route.extend({
       model(){
        return {
                    //...
                    
                    Export: function(args) {
                        var pGridObj = $('.e-pivotgrid').data("ejPivotGrid");
                        pGridObj.exportPivotGrid("http://js.syncfusion.com/ejservices/api/PivotGrid/Olap/WordExport", "fileName");
                    }
            }
        }
    });

    PDF export

    You can export the contents of pivot grid to a PDF document for future archival, references, and analysis purposes.

    To achieve PDF export, the service URL and the file name are set as parameters.

  • JS
  • import Ember from 'ember';
    
    export default Ember.Route.extend({
       model(){
        return {
                    //...
                    
                    Export: function(args) {
                        var pGridObj = $('.e-pivotgrid').data("ejPivotGrid");
                        pGridObj.exportPivotGrid("http://js.syncfusion.com/ejservices/api/PivotGrid/Olap/PDFExport", "fileName");
                    }
            }
        }
    });

    CSV export

    You can export the contents of pivot grid to a CSV document for future archival, references, and analysis purposes.

    To achieve CSV export, the service URL and the file name are set as parameters.

  • JS
  • import Ember from 'ember';
    
    export default Ember.Route.extend({
       model(){
        return {
                    //...
                    
                    Export: function(args) {
                        var pGridObj = $('.e-pivotgrid').data("ejPivotGrid");
                        pGridObj.exportPivotGrid("http://js.syncfusion.com/ejservices/api/PivotGrid/Olap/CSVExport", "fileName");
                    }
            }
        }
    });

    Customize the export document name

    For customizing file name, set the file name as parameter to the exportPivotGrid method along with service URL.

  • JS
  • import Ember from 'ember';
    
    export default Ember.Route.extend({
       model(){
        return {
                    //...
                    
                    Export: function(args) {
                        var pGridObj = $('.e-pivotgrid').data("ejPivotGrid");
                        pGridObj.exportPivotGrid("http://js.syncfusion.com/ejservices/api/PivotGrid/Olap/ExcelExport", "fileName");
                    }
            }
        }
    });

    Exporting customization

    You can add the title and description to the exporting document by using the title and description property obtained in the “beforeExport” event.

    <div class="e-control">
    	
    	{{ej-pivotgrid id="PivotGrid" e-dataSource=model.dataSource e-beforeExport=model.beforeExport}}
        {{ej-button id="Export" e-text="Export" e-click=model.Export }}
    	
    	</div>
    import Ember from 'ember';
    
    export default Ember.Route.extend({
       model(){
        return {
                    //...
                    
                    Export: function(args) {
                        var pGridObj = $('.e-pivotgrid').data("ejPivotGrid");
                        pGridObj.exportPivotGrid("http://js.syncfusion.com/ejservices/api/PivotGrid/Olap/ExcelExport", "fileName");
                    }
                    beforeExport: function(args) {
                        args.title = "PivotGrid";
                        args.description = "Displays both OLAP and Relational datasource in tabular format";
                    }
            }
        }
    });

    The following screenshot shows the pivot grid control exported to an Excel document:

    The following screenshot shows the pivot grid control exported to a Word document:

    The following screenshot shows the pivot grid control exported to a PDF document:

    The following screenshot shows the pivot grid control exported to a CSV document: