Docx: Numbering for nested lists

Created on 8 Dec 2020  路  2Comments  路  Source: dolanmiu/docx

Hi,
First of all, this is an amazing library and I would like to thank all the contributors for doing an amazing job!

My issue is that , I want nested numbering for nested lists meaning this is the current behavior,
image

Expected behavior is
image

Kindly let me know if there's a way around to achieve this.

Cheers,

Most helpful comment

Thanks @HTrayford

I have created a demo to showcase this using your example provided:

https://github.com/dolanmiu/docx/blob/master/demo/57-add-parent-numbered-lists.ts

All 2 comments

@bkmalan The key is add this: text: '%1.%2'

{
  level: 1,
  format: 'decimal',
  text: '%1.%2',
  alignment: AlignmentType.START,
  style: {
    paragraph: {
    indent: { left: 1.25 * leftIndent, hanging: 1.25 * hangingIndent }
  },
  run: {
    bold: true,
    size: subSectionFontSize * 2,
    font: primaryFont
  }
}

Thanks @HTrayford

I have created a demo to showcase this using your example provided:

https://github.com/dolanmiu/docx/blob/master/demo/57-add-parent-numbered-lists.ts

Was this page helpful?
0 / 5 - 0 ratings