Configuration

Configuration Reference

The ExportDataConfig interface provides the following options:

Column Definitions

  • header (string): The column header to display.

  • key (string): The key to map the data value.

  • width (number): The column width (default: 20).

Example:

const columnDefinitions = [
    { header: 'Username', key: 'name', width: 30 },
    { header: 'Phone Number', key: 'phone', width: 15 },
];

Cell Style

Customize the appearance of individual cells:

const cellStyle = {
    name: 'Arial',
    size: 12,
    ARGBColor: 'FF0000FF',
    bold: true,
    horizontalAlignment: 'center',
    verticalAlignment: 'middle',
};

UtilsService: Field Conversion

You need to inject the UtilsService

The UtilsService provides a method for optional field conversion:

convertFieldsToStrings

Convert object fields to string representations using a provided configuration. This operation does not happen automatically and must be invoked explicitly.

Titles (Horizontal and Vertical)

Add titles to the worksheet for better presentation.

Horizontal Title

Vertical Title

Example Usage

Export Data to Excel

Export Data to CSV

Last updated