Code Monkey home page Code Monkey logo

export-html-table-to-excel's Introduction

ReactHTMLTableToExcel

Provides a client side generation of Excel (.xls) file from HTML table element.


No additional dependencies


Installation

npm install --save export-html-table-to-excel

Features

  • Download HTML table as Excel file in .xls format
  • No server side code
  • Set desired .xls filename and sheet
  • Set desired class name and id for styling
  • Supported IE 11

Options

A list of available properties can be found below. These must be passed to the containing ReactHTMLTableToExcel component.

Property Type Description
table string ID attribute of HTML table element.
filename string Name of Excel file.
sheet string Name of Excel sheet.
id string ID attribute of button element.
className string Class attribute of button element.
buttonText string Button text.
children element Child elements to render instead of the button text.

Example

import React, { Component } from "react";
import ReactHTMLTableToExcel from "export-html-table-to-excel";

class Test extends Component {
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <div>
        <ReactHTMLTableToExcel
          id="test-table-xls-button"
          className="download-table-xls-button"
          table="table-to-xls"
          filename="tablexls"
          sheet="tablexls"
          buttonText="Download as XLS"
        />
        <table id="table-to-xls">
          <tr>
            <th>Firstname</th>
            <th>Lastname</th>
            <th>Age</th>
          </tr>
          <tr>
            <td>Jill</td>
            <td>Smith</td>
            <td>50</td>
          </tr>
          <tr>
            <td>Eve</td>
            <td>Jackson</td>
            <td>94</td>
          </tr>
        </table>
      </div>
    );
  }
}

export default Test;

export-html-table-to-excel's People

Contributors

samsularifin05 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.