1.0.56 • Published 6 years ago

favana-docx v1.0.56

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

favana-docx npm version

This module can generate Office Open XML files for Microsoft Office 2007 and later. Also the output is a stream and file, not dependent on any output tool. This module should work on any environment that supports Node.js 10.3.0 or later including Windows.

This module generate Word (.docx) document and stream.

Feature :

  • Generating Microsoft Word document (.docx file):

    • Create Word document.
    • You can add one or more paragraphs to the document and you can set the fonts, colors, alignment, etc.
    • You can add one or more table to the document and you can set the fonts, colorFont , backgroundCell, etc.
    • Support Merge in Table.
  • Generating Microsoft Word document (stream):

    • You can generate word document in the format stream.
  • Generating Microsoft Word document (pdf):

    • You can generate word document in the format pdf.

Installation :

via Git:

  https://github.com/Favana/Favana-docx.git

via npm:

  $npm i -g npm
  $npm i --save favana-docx

This module is depending on:

  • @salishq/loadash
  • @types/archiver
  • @types/node
  • loadash
  • archiver
  • express

Public API :

  • generate word document (.docx file):

     var docx_officegen =  require('favana-docx');
    
     var docx = new docx_officegen.Docx(fileName, filePath);
     docx.createTable(data);
     docx.createP();
     docx.addContentP(data, styleObject);
    
     var out = docx.generate();
    
         if(out == false){
           // your syntax
         }else{
            console.log(out)
            // OR generate file OR Stream and Pdf
         }
  • generate word document (stream):

       var docx_officegen =  require('favana-docx');
       var express  = require('express');
       var app = express();
    
       var docx = new docx_officegen.Docx(fileName, filePath);
       docx.createTable(data);
       docx.createP();
       docx.addContentP(data, styleObject);
    
       var out = docx.generate();
    
          if(out == false){
             // your syntax
          }else{
             // create stream //
             app.get(url, function(request, response){
    
                  response.writeHead(200, {
                      "Content-Type": "application/docx",
                      "Content-Disposition": "attachment; filename=filename.docx"
                  });
                  docx.CreateStream(function(data){
                        data.pipe(response);
                        data.on('finish', function(){
                            console.log('The stream has been created and the file is ready to download');
                        });
                  }); // docx.CreateStream
    
             }); // app.get
             var server = app.listen(3000, function () {
                     console.log('Listining On', server_1.address().port);
             });
          }
1.0.56

6 years ago

1.0.55

6 years ago

1.0.54

6 years ago

1.0.53

6 years ago

1.0.52

6 years ago

1.0.51

6 years ago

1.0.50

6 years ago

1.0.49

6 years ago

1.0.48

6 years ago

1.0.47

6 years ago

1.0.46

6 years ago

1.0.45

6 years ago

1.0.44

6 years ago

1.0.42

6 years ago

1.0.41

6 years ago

1.0.40

6 years ago

1.0.39

6 years ago

1.0.38

6 years ago

1.0.37

6 years ago

1.0.36

6 years ago

1.0.35

6 years ago

1.0.34

6 years ago

1.0.33

6 years ago

1.0.32

6 years ago

1.0.31

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago