I
I
Igor Myasnikov2021-02-09 19:51:00
Node.js
Igor Myasnikov, 2021-02-09 19:51:00

How to create DOCX using node.js and JSON data?

Good afternoon! How can a normal list be generated from an array of data?
I use the docx library
Generating a file is not a problem, but creating a list, for example, from an array does not work

records.forEach(record => {
doc.addSection({
  children: [
     new Paragraph({
        text: `${record.name} - ${record.id}`,
     }),
   ],
  });
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuriy Vorobyov, 2021-02-09
@pilium

Here is an example of creating a list in a document.
You need to replace the paragraph with numbering and specify nesting levels

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question