officegen icon indicating copy to clipboard operation
officegen copied to clipboard

XLSX Date support

Open lagomarsino opened this issue 10 years ago • 2 comments

Using the two dimensional array, dates are written as zero values:

var fs = require('fs');
var officegen = require('officegen');
var xlsx = officegen ( 'xlsx' );

xlsx.on ( 'finalize', function ( written ) {
            console.log ( 'Finish to create an Excel file.\nTotal bytes created: ' + written + '\n' );
        });

xlsx.on ( 'error', function ( err ) {
            console.log ( err );
        });

sheet = xlsx.makeNewSheet ();
sheet.name = 'Excel Test';

// The direct option - two-dimensional array:
sheet.data[0] = [];
sheet.data[0][0] = new Date();

var out = fs.createWriteStream ( 'out.xlsx' );

out.on ( 'error', function ( err ) {
    console.log ( err );
});

xlsx.generate ( out );

lagomarsino avatar Jul 06 '14 20:07 lagomarsino

+1, or some feature to set type of cells. For example if you put 02/16/2015 now not it's readed as date.

CodersBrothers avatar Feb 15 '15 19:02 CodersBrothers

@lagomarsino, this is random but any way to contact you?

Clome avatar Apr 13 '24 16:04 Clome