How to use the docx.Numbering 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
export: function (path, html, font, indent, callback) {

      let currentParagraph = null;
      let boldActive = false;
      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;

docx

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

MIT
Latest version published 14 days ago

Package Health Score

85 / 100
Full package analysis