Configuring Export

Summary

  • Developers can configure Export at design time in multiple ways

There are many aspects of Export that can be configured by developers, primarily through properties in Export Options, or functions in Export API.

Advanced Exporting

By default Export will send the report to the desired destination in a straightforward way.

For instance exporting to Excel will create a new workbook with default worksheet settings.

However sometimes users want more fine-grained control over the Exported file, e.g. to change the worksheet names, font, or other properties in Excel.

This is possible by using the exportReport function in Export API.

It takes an optional exportConfig property which allows users to modify the params being sent.

exportReport

Multiple Params
Promise<void>
Exports a Report (with fine-grained control if needed)
Configuring Export
Fork
  • In this demo we export data to Excel and CSV via the exportReport function in Export API (using Custom Toolbar Buttons), allowing us add bespoke config:
    • We export Current Layout report to Excel, with custom names for Excel Workbook and Worksheet, and changing font and header row height
    • We export All Data report to CSV, with custom filename and separator

Configuring Report File Names

By default the name of the file created in an Export is that of the exported Report Name (e.g. 'All Data').

There are 2 options available in Export Options to change this behaviour:

  • appendFileTimestamp which appends a Timestamp to the Report name

appendFileTimestamp

Default: false
boolean
Whether to add a timestamp as a suffix to exported file name
  • reportFilename which allows a completely different Report name to be used

reportFilename

(reportFileNameContext: ReportFileNameContext) => boolean
Function enabling bespoke Report file names
Configuring Report FileNames
Fork
  • In this example we provide a custom File Name - but just for the "All Data" Report

Setting Exportable Columns

By default every Column in AdapTable is exportable.

This means that it can be included in System Reports (e.g. All Data) and will be available in UI for selection.

This can be set to false for any Column via the isColumnExportable property in Export Options.

isColumnExportable

Default: true
boolean
Whether a Column is exportable
Setting Exportable Columns
Fork
  • In this example we dont export the Language Column, nor any Date Columns

Skipping Column Headers

By default AdapTable will include the Column Headers in the Export.

This can be set to false all or some Reports via the skipColumnHeaders property in Export Options.

skipColumnHeaders

Default: true
boolean
Whether to include Column Headers in Report
Skipping Column Headers
Fork
  • In this example we exclude Custom Headers from the "All Data" Report only