Monday 12 June 2017

nodejs - officegen - pipesCount

in order to create word documents, i use officegen package:

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

  var docx = officegen ({
    'type': 'docx',
    'title': 'test title'
  })

  var pObj = docx.createP ();
  pObj.addText('Text');
  pObj.addText('with color', {color: '000088'});
  pObj.addText('and back color.', {color: '00ffff',back: '000088'});

  var out = fs.createWriteStream(__dirname + '/tmp/out.docx');
  docx.generate(out)
  out.on('error', function(err) {
    console.log('out error: ' + err);
  });

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

  docx.on('error', function(err) {
    console.log('docx appeared: ' + err);
  });

What happens:

File get created, with content 'PK'

Why?

Error thrown in console:

Cannot read property 'pipesCount' of undefined

Anybody faced this issue before?

Greetings and thanks



via Creative crypter

No comments:

Post a Comment