0.3.1 • Published 10 years ago

node-jxls2 v0.3.1

Weekly downloads
20
License
ISC
Repository
github
Last release
10 years ago

node-excel-exporter

Export data into excel templates from javascript objects and collections. This is a partial port of jxls java library to node.

Documentation in progress ... .

Installation

  npm install node-jxls2

This module depends on node-java and node-java-maven. So make sure you have your environment set up for node-gyp and that you have java and maven installed. On windows, you may need to specify the npm option --msvs_version (visual studio version). For example

  npm install node-jxls2 --msvs_version=2013

Usage

Export javascript objects and collections

var path = require('path');
var excel = require('node-jxls2').create();
var data = [
    {
        name: 'obj',
        value: {
            firstname: 'Jonatan',
            age: 70,
            dob: new Date(),
            dep: {
                depname: 'IT Department',
                grade: 'Manager'
            },
            cols: [
                {
                    v: 'test1'
                },
                {
                    v: 'test3'
                }
            ]
        }
    }, {
        name: 'myCollection',
        value: [

            {
                color: "red",
                value: "#f00"
            },
            {
                color: "green",
                value: "#0f0"
            },
            {
                color: "blue",
                value: "#00f"
            },
            {
                color: "cyan",
                value: "#0ff"
            },
            {
                color: "magenta",
                value: "#f0f"
            },
            {
                color: "yellow",
                value: "#ff0"
            },
            {
                color: "black",
                value: "#000"
            }

        ]
    }
];
var tpl = path.join(__dirname, 'template.xlsx');
var tplOut = path.join(__dirname, 'template_out.xlsx');
excel.export(data, tpl, tplOut, function () {
    console.log('OK');
})

In excel template, you put placeholders for your data like this:

  ${obj.firstname}
  

Please refer to jxls documentation for templates usage. Have a look at examples directory.

0.3.1

10 years ago

0.3.0

10 years ago

0.2.9

10 years ago

0.2.8

10 years ago

0.2.7

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago