Giter VIP home page Giter VIP logo

html-to-xlsx's Introduction

html-to-xlsx

NPM Version License Build Status

node.js html to xlsx transformation

Transformation only supports html table and several basic style properties. No images or charts are currently supported.

var conversion = require("html-to-xlsx")();
conversion("<table><tr><td>cell value</td></tr></table>" }, function(err, stream){
  //readable stream to xlsx file
  stream.pipe(res);
});

Supported properties

  • background-color - cell background color
  • color - cell foreground color
  • border-left-style - as well as positions will be transformed into excel cells borders
  • text-align - text horizontal align in the excel cell
  • vertical-align - vertical align in the excel cell
  • width - the excel column will get the highest width, it can be little bit inaccurate because of pixel to excel points conversion
  • height - the excel row will get the highest height
  • font-size - font size
  • colspan - numeric value that merges current column with columns to the right
  • rowspan - numeric value that merges current row with rows below.
  • overflow - the excel cell will have text wrap enabled if this is set to scoll.

Options

var conversion = require("html-to-xlsx")({
  /* use rather dedicated process for every phantom printing,
	  "dedicated-process" strategy is quite slower but can solve some bugs
	  with corporate proxy, default is "phantom-server" */
  strategy: 'phantom-server', // 'dedicated-process' or 'phantom-server'
  /* number of allocated phantomjs processes */
	numberOfWorkers: 2,
	/* timeout in ms for html conversion, when the timeout is reached, the phantom process is recycled */
	timeout: 5000,
	/* directory where are stored temporary html and pdf files, use something like npm package reaper to clean this up */
	tmpDir: "os/tmpdir",
	/* optional port range where to start phantomjs server */
  portLeftBoundary: 1000,
  portRightBoundary: 2000,
  /* optional hostname where to start phantomjs server */
  host: '127.0.0.1'
});

Kill workers

// kill all phantomjs workers when using phantom-server strategy
conversion.kill();

License

See license

html-to-xlsx's People

Contributors

pofider avatar bjrmatos avatar allenconcur avatar areinmeyer avatar jamcnaughton 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.