gutkyu / xlgen

node.js's module to generate Microsoft Excel 97 ~ 2003 File(.xls)
MIT License
23 stars 8 forks source link

XLGen

node.js's module to generate Microsoft Excel™ 97 ~ 2003 File(.xls)

Features

Changelog

v0.2.3

v0.2.2

v0.2.1

v0.1.0

API

XLGen class

Sheet class

Example

var xl = require('xlgen');
var xlg = xl.createXLGen('./test.xls');

//register formats
var fmtDate0 = xlg.addFormat(xl.formatStrings.date0);
var fmtDate1 = xlg.addFormat(xl.formatStrings.date1);
var fmtDate2 = xlg.addFormat(xl.formatStrings.date2);
var custfmtDate = xlg.addFormat('0.0000E+00');

var sht = xlg.addSheet('Sheet1');
//var sht = xlg.addSheet('시트1');

console.log(xl.formatStrings);//print all standard format strings

try{
   sht.cell(0, 1, 1);
   sht.cell(1, 1, 2.1);
   sht.cell(2, 3, 'hi!');
   sht.cell(3, 3, '안녕!');
   sht.cell(5, 4, new Date);
   sht.cell(6, 4, new Date, fmtDate0);
   sht.cell(7, 4, 10000, fmtDate0);
   sht.cell(8, 4, new Date, fmtDate1);
   sht.cell(9, 4, new Date, fmtDate2);
   sht.cell(10, 4, 9999, custfmtDate);
}catch(e){
   console.log(e.name, e.message);
}

xlg.end(function(err){
   if(err) console.log(err.name, err.message);
   else console.log('complete');
});

References

[MS-XLS]: Excel Binary File Format (.xls) Structure

License

MIT