Vue Data GridExcel Export - Page Setup

Enterprise

Excel Export allows you to configure the page settings for the exported Excel file.

Page Setup Copy

You can customise the Excel export page settings such as page size, orientation, and margin, using the pageSetup and margins configs of the Excel Export Params. These settings are visible when printing the exported Excel file or exporting to PDF.

<ag-grid-vue
    :defaultExcelExportParams="defaultExcelExportParams"
    /* other grid options ... */>
</ag-grid-vue>

this.defaultExcelExportParams = {
    pageSetup: {
        orientation: 'Landscape',
        pageSize: 'A3'
    },
    margins: {
        top: 1,
        right: 1,
        bottom: 1,
        left: 1,
        header: 0.5,
        footer: 0.5,
    }
};

The value of the margins must be provided in inches.

Note the following:

  • The sample below allow you to configure the page size, orientation and margin values.
  • Page size and orientation are stored in the pageSetup object.
  • Margin values are stored in the margins object.

Interfaces Copy

ExcelExportParams Copy

interface ExcelExportParams {
    // ...
    margins?: ExcelSheetMargin;
    pageSetup?: ExcelSheetPageSetup
}

ExcelSheetMargin Copy

Properties available on the ExcelSheetMargin interface.

topCopy
number
default: 0.75
The sheet top margin.
rightCopy
number
default: 0.7
The sheet right margin.
bottomCopy
number
default: 0.75
The sheet bottom margin.
leftCopy
number
default: 0.7
The sheet left margin.
headerCopy
number
default: 0.3
The sheet header margin.
number
default: 0.3
The sheet footer margin.

ExcelSheetPageSetup Copy

Properties available on the ExcelSheetPageSetup interface.

orientationCopy
'Portrait' | 'Landscape'
default: 'Portrait'
Use this property to change the print orientation.
pageSizeCopy
| 'Letter' | 'Letter Small' | 'Tabloid' | 'Ledger' | 'Legal' | 'Statement' | 'Executive' | 'A3' | 'A4' | 'A4 Small' | 'A5' | 'A6' | 'B4' | 'B5' | 'Folio' | 'Envelope' | 'Envelope DL' | 'Envelope C5' | 'Envelope B5' | 'Envelope C3' | 'Envelope C4' | 'Envelope C6' | 'Envelope Monarch' | 'Japanese Postcard' | 'Japanese Double Postcard'
default: 'Letter'
Use this property to set the sheet size.