pdfmake icon indicating copy to clipboard operation
pdfmake copied to clipboard

Nested Ordered Lists

Open SawkaDev opened this issue 1 year ago • 2 comments

Given the following dd

// playground requires you to assign document definition to a variable called dd

var dd = {
  "content": [
    {
      "ol": [
        {
          "text": "ordere list one"
        },
        {
          "ol": [
            {
              "text": "nested"
            },
            {
              "text": "nested again"
            },
            {
              "ol": [
                {
                  "text": "double nested"
                }
              ]
            }
          ]
        },
        {
          "text": "ordered list two"
        }
      ]
    }
  ]
}

Produces the following numbering

image

Is this expected? Is my dd incorrect in some way?

SawkaDev avatar May 04 '23 16:05 SawkaDev

I still have yet to figure this out. I am unable to find any solution. Any thoughts?

SawkaDev avatar May 30 '23 21:05 SawkaDev

any updates on this?

SawkaDev avatar Dec 01 '23 14:12 SawkaDev

You can wrap a list item and the subsequent nested list in an array:

var dd = {
  "content": [
    {
      "ol": [
        [
            {
              "text": "ordere list one"
            },
            {
              "ol": [
                {
                  "text": "nested"
                },
                [
                    {
                      "text": "nested again"
                    },
                    {
                      "ol": [
                        {
                          "text": "double nested"
                        }
                      ]
                    }
                ]
              ]
            }
        ],
        {
          "text": "ordered list two"
        }
      ]
    }
  ]
}

image

fe-cj avatar Jul 28 '24 17:07 fe-cj

Fixed by PR https://github.com/bpampuch/pdfmake/pull/2760. Released in version 0.2.11.

liborm85 avatar Aug 09 '24 05:08 liborm85