Creating lists, ordered or bulleted, using the template object is possible using repeat blocks. However, sometimes you may wish to include a list inside another repeat block, but you run into the following hurdles:
- WordTemplate does not support nested repeat blocks
- WordApplication can dynamically insert lists, but it is not available in WordWriter Standard Edition
- WordTemplate nesting and grouping can also handle nested lists, but is only available in Enterprise Edition.
Using the WordTemplate object, one cannot populate a fully functional list within a repeat block. However, it is possible to emulate the look of such lists. The general idea is to concatenate the list items into one formatted string that Word displays as a list. These strings can be stored in any database. This solution works for both binary (.doc) and OOXML (.docx) formats in office 2007.
For bulleted lists, use the following format:
“• First item\r\n• Second item”
For numbered lists, use the following format:
“1) First item\r\n2) Second item”
“1. First item\r\n2. Second item”
Note that the generic string format that will be displayed as a list in Word uses the two characters “\r\n” as the separator between the items.