Bulleted List in Word Processing Document

Note
In this article, we use GroupDocs.Assembly for Node.js via Java to generate a bulleted list report in a Word document.

Bulleted list in a Microsoft Word document

Creating a bulleted list

To add a bulleted list to a Word document:

  1. Place the cursor where the list should appear.
  2. On the Home tab, click Bullets.
  3. Type the template tags described below and save the document.

Reporting requirement

As a report developer, you need to meet the following requirements:

  • The report must show all clients in a bulleted list.
  • The report must be generated as a Word document.

Data source

Save the clients as clients.json:

[
  { "Name": "A Company" },
  { "Name": "B Ltd." },
  { "Name": "C & D" },
  { "Name": "E Corp." }
]

Adding syntax to be evaluated by GroupDocs.Assembly engine

Put the opening foreach tag and the client name into a bulleted paragraph, and the closing tag into the next paragraph:

We provide support for the following clients:
• <<foreach [client in clients]>><<[client.Name]>>
<</foreach>>

The engine repeats the bulleted paragraph for every client, so the report contains one bullet per client.

Download the bulleted list template

Download the sample files used in this article:

Generating the report

'use strict';

const groupdocs = require('@groupdocs/groupdocs.assembly');

// "clients" is the data source name used in the template
const dataSource = new groupdocs.JsonDataSource("clients.json");
const dataSourceInfo = new groupdocs.DataSourceInfo(dataSource, "clients");

const assembler = new groupdocs.DocumentAssembler();
assembler.assembleDocument("bulleted-list-template.docx", "bulleted-list-report.docx", dataSourceInfo);

process.exit(0);

Result

The generated bulleted-list-report.docx contains:

We provide support for the following clients:

  • A Company
  • B Ltd.
  • C & D
  • E Corp.

Bulleted list in an OpenDocument text document

The same template syntax works in ODT documents created with Microsoft Word, LibreOffice or Apache OpenOffice. Save the template as .odt and use an .odt output file name, or save the report to another format as described in Changing Target File Format.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.