Overview + installation

Before starting, you need to be authenticated, since the package is hosted within a private npm registry, the authentication steps are described before.

Authentication chevron-right

This package enables developers to seamlessly export data to Excel or CSV files while offering extensive customization options for formatting, styling, and data conversion. The package is built using NestJS and depends on the ExcelJS library to manage Excel-specific operations. It provides utilities and services to generate structured and styled export files without requiring routes or APIs.

Quick Start

  1. Import the ExportDataModule: Import the ExportDataModule to make the package services available. The services will not function without this module

import { ExportDataModule } from ' @tradinos/cms-backend-export-data';

@Module({
    imports: [ExportDataModule],
})
export class AppModule {}
  1. Import the Package: Import the required services and utilities from the package.

  2. Create a New Service: Use the ExportDataService to validate and export your data.

  3. Provide Configuration: Customize your export settings for columns, styles, and file types (Excel or CSV).

Features

  • Data Validation: Ensure all data values are strings, not undefined or null, with detailed error messages.

  • Dynamic Column Definitions: Define headers, keys, and column widths.

  • Customizable Styles: Apply styles to cells, rows, or columns, including font size, alignment, and colors.

  • Optional Field Conversion: Use UtilsService to format fields like numbers, dates, and booleans..

  • Horizontal and Vertical Titles: Add titles with customizable alignment and styling

Install the package in your app :

Last updated