UNPKG

table-to-excel-react

Version:
65 lines (64 loc) 1.48 kB
import React from 'react'; import { IProps } from './interfaces/table-to-excel-react'; import { useDownloadExcel } from './hooks/useExportExcel'; /** * TableToExcelReact component for exporting HTML tables to Excel * * @example * ```jsx * <TableToExcelReact * table="my-table-id" * fileName="my-excel-file" * sheet="Sheet1" * format="xlsx" * > * <button>Export to Excel</button> * </TableToExcelReact> * ``` * * @example Multiple tables * ```jsx * <TableToExcelReact * tables={["table1", "table2"]} * fileName="multiple-tables" * > * <button>Export Multiple Tables</button> * </TableToExcelReact> * ``` * * @example Custom data * ```jsx * <TableToExcelReact * data={[["John", 30], ["Jane", 25]]} * headers={["Name", "Age"]} * fileName="custom-data" * sheet="Users" * > * <button>Export Custom Data</button> * </TableToExcelReact> * ``` * * @example Styled export * ```jsx * <TableToExcelReact * table="my-table" * fileName="styled-export" * styles={{ * headerRow: { * font: { bold: true, color: "#ffffff" }, * fill: { backgroundColor: "#4472C4" } * }, * dataRow: { * font: { color: "#000000" } * }, * alternatingRow: { * fill: { backgroundColor: "#E9EDF4" } * } * }} * > * <button>Export Styled Excel</button> * </TableToExcelReact> * ``` */ declare const TableToExcelReact: React.FC<IProps>; export { TableToExcelReact, useDownloadExcel };