excel-export-impr
Version:
Data set export to Excel xlsx file (Hyperlinks support)
30 lines (26 loc) • 1.08 kB
JavaScript
// test/main.js
var should = require('should');
var nodeExcel = require('../index');
describe('Simple Excel xlsx Export', function() {
describe('Export', function() {
it('returns xlsx', function() {
var conf ={};
conf.cols = [
{caption:'string', type:'string'},
{caption:'date', type:'date'},
{caption:'bool', type:'bool'},
{caption:'number 2', type:'number'},
{caption:'link', type:'hyperlink'}
];
conf.rows = [
['pi', (new Date(Date.UTC(2013, 4, 1))).oaDate(), true, 3.14, { text: 'Google', href: 'http://www.google.com'}],
["e", (new Date(2012, 4, 1)).oaDate(), false, 2.7182, { text: 'Google', href: 'http://www.google.com'}],
["M&M<>'", (new Date(Date.UTC(2013, 6, 9))).oaDate(), false, 1.2, { text: 'Google', href: 'http://www.google.com'}],
["null", null, null, null, { text: 'null', href: 'null'}]
];
var result = nodeExcel.execute(conf);
var fs = require('fs');
fs.writeFileSync('d.xlsx', result, 'binary');
});
});
});