New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-easy-export

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-easy-export

A React library for easily exporting data to CSV, PDF, and Excel formats.

latest
npmnpm
Version
1.0.1
Version published
Weekly downloads
1.4K
-45.5%
Maintainers
1
Weekly downloads
 
Created
Source

Getting Started with react-easy-export

npm install react-easy-export or
yard add react-easy-export

Usage

CSV

Exports data as a CSV file.
@param {Array | Array<Array>} data - Array of objects or 2D array representing data.
@param {string} [filename=data.csv'] - Optional. The name of the exported file.
@param {string} [separator=','] - Optional. Separator used between values.

Example

import { exportToCSV } from 'react-export-ease';

const data = [
  { name: "Ethan", gender: "male" },
  { name: "Jane", gender: "female" }
];

exportToCSV(data, 'users.csv');
// Alternatively:
exportToCSV(data);

Excel

Exports data as an Excel (.xls) file.
@param {Array | Array<Array>} data - The data to be exported. Can be an array of objects or a 2D array.
@param {string} [filename='data.xls'] - Optional. Name of the exported file.
Note: This method generates an older Excel format (.xls) using an HTML table. It may not support advanced Excel features.

Example

import { exportToExcel } from 'react-export-ease';

const data = [
  ["Name", "Gender"],
  ["Ethan", "Male"],
  ["Jane", "Female"]
];

exportToExcel(data, 'users.xlsx');
// Alternatively:
exportToExcel(data);

PDF

Exports HTML as a PDF file.
@param {string} content - The HTML content to be printed to PDF.
@param {string} [filename='data.pdf'] - Optional. Name of the exported file (though this can't be enforced through the print dialog).

Example

import { exportToPDF } from 'react-export-ease';

const content = `
  <h1>Users</h1>
  <ul>
    <li>Ethan: male</li>
    <li>Jane: female</li>
  </ul>
`;

exportToPDF(content, 'users.pdf');
// Alternatively:
exportToPDF(content);

Contributing

We welcome contributions! Please open an issue or submit a pull request if you would like to help improve react-easy-export.

License

MIT
See LICENSE.md

Keywords

react

FAQs

Package last updated on 01 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts