How to use the docx.Document function in docx

To help you get started, we’ve selected a few docx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andreafeccomandi / bibisco / bibisco / app / services / DocxExporterService.js View on Github external
let italicsActive = false;
      let underlineActive = false;
      let strikeActive = false;
      let orderedListActive = false;
      let unorderedListActive = false;
      let h1counter = 0;
      let h2counter = 0;
      let h3counter = 0;
    
      const numbering = new docx.Numbering();
      const numberedAbstract = numbering.createAbstractNumbering();
      numberedAbstract.createLevel(0, 'decimal', '%1. ', 'left');
      const letterNumbering = numbering.createConcreteNumbering(numberedAbstract);

      // Create document
      let doc = new docx.Document();

      var parser = new htmlparser.Parser({

        onopentag: function (name, attribs) {

          if (name === 'exporttitle') {
            currentParagraph = new docx.Paragraph();
            currentParagraph.center();
            currentParagraph.spacing(exportitlespacing);
            boldActive = true;

          } else if (name === 'exportsubtitle') {
            currentParagraph = new docx.Paragraph();
            currentParagraph.center();
            boldActive = true;

docx

Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.

MIT
Latest version published 5 days ago

Package Health Score

83 / 100
Full package analysis