0.4.2 • Published 5 years ago

html2xlsx v0.4.2

Weekly downloads
41
License
MIT
Repository
github
Last release
5 years ago

html2xlsx

Transform html to excel (just support xlsx)

NPM version NPM downloads Build Status Coverage Status Dependency Status Greenkeeper badge


Install

$ npm install html2xlsx

Usage

const fs = require('fs');
const htmlTo = require('html2xlsx');

htmlTo(`
  <style type="text/css">
    table td {
      color: #666;
      height: 20px;
      background-color: #f1f1f1;
      border: 1px solid #eee;
    }
  </style>
  <table>
    <tr>
      <td>foo</td>
      <td>bar</td>
    </tr>
    <tr>
      <td>hello</td>
      <td>world</td>
    </tr>
    <tr>
      <td type="number">123</td>
      <td type="number">123.456</td>
    </tr>
    <tr>
      <td data-type="bool">true</td>
      <td data-type="bool">false</td>
    </tr>
    <tr>
      <td data-type="bool">1</td>
      <td data-type="bool">0</td>
    </tr>
    <tr>
      <td type="formula">SUM(A1:B1)</td>
      <td type="formula">A1-B1</td>
    </tr>
    <tr>
      <td type="date">2013-01-12T12:34:56+08:00</td>
      <td type="datetime">2013-01-12T12:34:56+08:00</td>
    </tr>
  </table>
`, (err, file) => {
  if (err) return console.error(err);
  
  file.saveAs()
    .pipe(fs.createWriteStream('test.xlsx'))
    .on('finish', () => console.log('Done.'));
});

Report a issue

Reference

License

html2xlsx is available under the terms of the MIT License.

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago